[GRASS-SVN] r48809 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 14 15:08:10 EDT 2011


Author: martinl
Date: 2011-10-14 12:08:10 -0700 (Fri, 14 Oct 2011)
New Revision: 48809

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: fully-qualified names only for input/map
       (merge r48807 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2011-10-14 19:06:31 UTC (rev 48808)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2011-10-14 19:08:10 UTC (rev 48809)
@@ -55,7 +55,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
@@ -67,6 +68,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")
@@ -78,7 +80,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):
@@ -149,6 +152,7 @@
         self.mapsets = None
         self.updateOnPopup = True
         self.onPopup = None
+        self.fullyQualified = True
         
         self.SetFilter(None)
         
@@ -469,8 +473,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
@@ -500,8 +505,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
@@ -525,7 +531,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/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2011-10-14 19:06:31 UTC (rev 48808)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2011-10-14 19:08:10 UTC (rev 48809)
@@ -1087,8 +1087,10 @@
                         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')
                         
+                        
                         # A select.Select is a combobox with two children: a textctl and a popupwindow;
                         # we target the textctl here
                         textWin = selection.GetTextCtrl()



More information about the grass-commit mailing list