[GRASS-SVN] r32679 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 11 06:16:18 EDT 2008
Author: martinl
Date: 2008-08-11 06:16:18 -0400 (Mon, 11 Aug 2008)
New Revision: 32679
Modified:
grass/trunk/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI: don't crash when gis element is selected repeatedly
merge from devbr6, r32678
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2008-08-11 10:12:39 UTC (rev 32678)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2008-08-11 10:16:18 UTC (rev 32679)
@@ -99,7 +99,7 @@
def GetStringValue(self):
str = ""
for value in self.value:
- str += self.seltree.GetItemText(value) + ","
+ str += value + ","
str = str.rstrip(',')
return str
@@ -110,9 +110,13 @@
self.GetElementList(self.type, self.mapsets, self.exceptOf)
if len(self.value) > 0:
- self.seltree.EnsureVisible(self.value[0])
- self.seltree.SelectItem(self.value[0])
-
+ root = self.seltree.GetRootItem()
+ if not root:
+ return
+ item = self.FindItem(root, self.value[0])
+ self.seltree.EnsureVisible(item)
+ self.seltree.SelectItem(item)
+
def SetStringValue(self, value):
# this assumes that item strings are unique...
root = self.seltree.GetRootItem()
@@ -242,7 +246,7 @@
if self.seltree.ItemHasChildren(item):
item = self.FindItem(item, text)
item, cookie = self.seltree.GetNextChild(parentItem, cookie)
- return wx.TreeItemId();
+ return wx.TreeItemId()
def AddItem(self, value, parent=None):
@@ -273,9 +277,10 @@
self.value = [] # cannot select mapset item
else:
if self.multiple is True:
- self.value.append(item)
+ # text item should be unique
+ self.value.append(self.seltree.GetItemText(item))
else:
- self.value = [item, ]
+ self.value = [self.seltree.GetItemText(item), ]
self.Dismiss()
More information about the grass-commit
mailing list