[GRASS-SVN] r48807 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Oct 14 15:06:01 EDT 2011
Author: martinl
Date: 2011-10-14 12:06:01 -0700 (Fri, 14 Oct 2011)
New Revision: 48807
Modified:
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: fully-qualified names only for input/map
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-10-14 18:58:11 UTC (rev 48806)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-10-14 19:06:01 UTC (rev 48807)
@@ -56,7 +56,8 @@
class Select(wx.combo.ComboCtrl):
def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_GSELECT_SIZE,
type = None, multiple = False, mapsets = None,
- updateOnPopup = True, onPopup = None):
+ updateOnPopup = True, onPopup = None,
+ fullyQualified = True):
"""!Custom control to create a ComboBox with a tree control to
display and select GIS elements within acessible mapsets.
Elements can be selected with mouse. Can allow multiple
@@ -68,6 +69,7 @@
@param mapsets force list of mapsets (otherwise search path)
@param updateOnPopup True for updating list of elements on popup
@param onPopup function to be called on Popup
+ @param fullyQualified True to provide fully qualified names (map at mapset)
"""
wx.combo.ComboCtrl.__init__(self, parent=parent, id=id, size=size)
self.GetChildren()[0].SetName("Select")
@@ -79,7 +81,8 @@
if type:
self.tcp.SetData(type = type, mapsets = mapsets,
multiple = multiple,
- updateOnPopup = updateOnPopup, onPopup = onPopup)
+ updateOnPopup = updateOnPopup, onPopup = onPopup,
+ fullyQualified = fullyQualified)
self.GetChildren()[0].Bind(wx.EVT_KEY_UP, self.OnKeyUp)
def OnKeyUp(self, event):
@@ -150,6 +153,7 @@
self.mapsets = None
self.updateOnPopup = True
self.onPopup = None
+ self.fullyQualified = True
self.SetFilter(None)
@@ -471,8 +475,9 @@
self.value = []
else:
mapsetItem = self.seltree.GetItemParent(item)
- fullName = self.seltree.GetItemText(item) + '@' + \
- self.seltree.GetItemText(mapsetItem).split(':', -1)[1].strip()
+ fullName = self.seltree.GetItemText(item)
+ if self.fullyQualified:
+ fullName += '@' + self.seltree.GetItemText(mapsetItem).split(':', -1)[1].strip()
if self.multiple is True:
# text item should be unique
@@ -502,8 +507,9 @@
self.value = [] # cannot select mapset item
else:
mapsetItem = self.seltree.GetItemParent(item)
- fullName = self.seltree.GetItemText(item) + '@' + \
- self.seltree.GetItemText(mapsetItem).split(':', -1)[1].strip()
+ fullName = self.seltree.GetItemText(item)
+ if self.fullyQualified:
+ fullName += '@' + self.seltree.GetItemText(mapsetItem).split(':', -1)[1].strip()
if self.multiple is True:
# text item should be unique
@@ -527,7 +533,9 @@
self.updateOnPopup = kargs['updateOnPopup']
if 'onPopup' in kargs:
self.onPopup = kargs['onPopup']
-
+ if 'fullyQualified' in kargs:
+ self.fullyQualified = kargs['fullyQualified']
+
def GetType(self):
"""!Get element type
"""
Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py 2011-10-14 18:58:11 UTC (rev 48806)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py 2011-10-14 19:06:01 UTC (rev 48807)
@@ -1143,7 +1143,9 @@
selection = gselect.Select(parent = which_panel, id = wx.ID_ANY,
size = globalvar.DIALOG_GSELECT_SIZE,
type = p.get('element', ''),
- multiple = multiple, mapsets = mapsets)
+ multiple = multiple, mapsets = mapsets,
+ fullyQualified = p.get('age', 'old') == 'old')
+
value = self._getValue(p)
if value:
selection.SetValue(value)
More information about the grass-commit
mailing list