[GRASS-SVN] r48264 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 13 12:08:14 EDT 2011


Author: martinl
Date: 2011-09-13 09:08:13 -0700 (Tue, 13 Sep 2011)
New Revision: 48264

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
Log:
attempt to fix #1398 (problem with multiple entry selection)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py	2011-09-13 09:25:33 UTC (rev 48263)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py	2011-09-13 16:08:13 UTC (rev 48264)
@@ -187,13 +187,9 @@
         return self.seltree
 
     def GetStringValue(self):
-        str = ""
-        for value in self.value:
-            str += value + ","
-        str = str.rstrip(',')
-        
-        return str
-
+        """!Get value as a string separated by commas"""
+        return ','.join(self.value)
+    
     def SetFilter(self, filter):
         """!Set filter for GIS elements, see e.g. VectorSelect"""
         self.filterElements = filter
@@ -245,11 +241,15 @@
         if not root:
             return
         found = self.FindItem(root, value)
-        self.value = self.GetCombo().GetValue().strip(',').split(',')
+        winValue = self.GetCombo().GetValue().strip(',')
+        self.value = []
+        if winValue:
+            self.value = winValue.split(',')
+        
         if found:
             self.value.append(found)
             self.seltree.SelectItem(found)
-
+        
     def GetAdjustedSize(self, minWidth, prefHeight, maxHeight):
         """!Reads UserSettings to get height (which was 200 in old implementation).
         """
@@ -336,7 +336,7 @@
         
         first_mapset = None
         for mapset in mapsets:
-            mapset_node = self.AddItem('Mapset: ' + mapset)
+            mapset_node = self.AddItem(_('Mapset:') + ' ' + mapset)
             if not first_mapset:
                 first_mapset = mapset_node
             
@@ -356,9 +356,9 @@
                         
                         if self.filterElements:
                             if self.filterElements(fullqElem):
-                                self.AddItem(elem, parent=mapset_node)
+                                self.AddItem(elem, parent = mapset_node)
                         else:
-                            self.AddItem(elem, parent=mapset_node)
+                            self.AddItem(elem, parent = mapset_node)
             except StandardError, e:
                 sys.stderr.write(_("GSelect: invalid item: %s") % e)
                 continue
@@ -475,10 +475,10 @@
                     # text item should be unique
                     self.value.append(fullName)
                 else:
-                    self.value = [fullName, ]
+                    self.value = [fullName]
             
             self.Dismiss()
-
+        
     def OnMotion(self, evt):
         """!Have the selection follow the mouse, like in a real combobox
         """
@@ -501,11 +501,12 @@
                 mapsetItem = self.seltree.GetItemParent(item)
                 fullName = self.seltree.GetItemText(item) + '@' + \
                     self.seltree.GetItemText(mapsetItem).split(' ', 1)[1]
+                
                 if self.multiple is True:
                     # text item should be unique
                     self.value.append(fullName)
                 else:
-                    self.value = [fullName, ]
+                    self.value = [fullName]
             
             self.Dismiss()
         



More information about the grass-commit mailing list