[GRASS-SVN] r55181 - grass/branches/releasebranch_6_4/gui/wxpython/gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Feb 22 12:27:37 PST 2013
Author: annakrat
Date: 2013-02-22 12:27:35 -0800 (Fri, 22 Feb 2013)
New Revision: 55181
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_core/forms.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_core/gselect.py
Log:
wxGUI: fix #1893
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_core/forms.py 2013-02-22 19:00:00 UTC (rev 55180)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_core/forms.py 2013-02-22 20:27:35 UTC (rev 55181)
@@ -217,7 +217,6 @@
if name == 'LayerSelect':
if map in cparams and not cparams[map]['layers']:
win.InsertLayers(vector = map)
- win.Reset()
cparams[map]['layers'] = win.GetItems()
elif name == 'TableSelect':
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_core/gselect.py 2013-02-22 19:00:00 UTC (rev 55180)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_core/gselect.py 2013-02-22 20:27:35 UTC (rev 55181)
@@ -672,6 +672,8 @@
# default value
self.default = default
+ self.current = None
+ self.Bind(wx.EVT_COMBOBOX, self._selectionChanged)
self.InsertLayers(vector = vector)
@@ -695,15 +697,24 @@
layers.insert(0, str(self.default))
elif self.default not in layers:
layers.append(self.default)
-
+
if len(layers) >= 1:
self.SetItems(layers)
- def Reset(self):
- """!Reset value"""
+ self.Select()
+
+ def _selectionChanged(self, event):
+ """!Selection changed, store value."""
+ self.current = self.GetValue()
+ event.Skip()
+
+ def Select(self):
+ """!Select value (currently selected or default)"""
items = self.GetItems()
if items:
- if self.default:
+ if self.current is not None and self.current in items:
+ self.SetStringSelection(self.current)
+ elif self.default:
self.SetStringSelection(str(self.default))
else:
self.SetSelection(0)
More information about the grass-commit
mailing list