[GRASS-SVN] r41425 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Mar 13 12:35:40 EST 2010
Author: martinl
Date: 2010-03-13 12:35:40 -0500 (Sat, 13 Mar 2010)
New Revision: 41425
Modified:
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: be more consistent on ColumnSelect events
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2010-03-13 17:24:27 UTC (rev 41424)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2010-03-13 17:35:40 UTC (rev 41425)
@@ -657,20 +657,27 @@
self.SetValue('')
class ColumnSelect(wx.ComboBox):
+ """!Creates combo box for selecting columns in the attribute table
+ for a vector map.
+
+ @param parent window parent
+ @param id window id
+ @param value default value
+ @param size window size
+ @param vector vector map name
+ @param layer layer number
+ @param param parameters list (see menuform.py)
+ @param **kwags wx.ComboBox parameters
"""
- Creates combo box for selecting columns in the attribute table for a vector.
- The 'layer' terminology is likely to change for GRASS 7
- """
- def __init__(self, parent,
- id=wx.ID_ANY, value='', pos=wx.DefaultPosition,
- size=globalvar.DIALOG_COMBOBOX_SIZE, vector=None,
- layer=1, choices=[]):
+ def __init__(self, parent, id = wx.ID_ANY, value = '',
+ size=globalvar.DIALOG_COMBOBOX_SIZE,
+ vector = None, layer = 1, param = None, **kwargs):
self.defaultValue = value
+ self.param = param
- super(ColumnSelect, self).__init__(parent, id, value, pos, size, choices)
+ super(ColumnSelect, self).__init__(parent, id, value, size = size, **kwargs)
+ self.SetName("ColumnSelect")
- self.SetName("ColumnSelect")
-
if vector:
self.InsertColumns(vector, layer)
@@ -698,14 +705,22 @@
if value['type'] not in type:
columns.remove(key)
except (KeyError, ValueError):
- columns = []
-
+ columns = list()
+
self.SetItems(columns)
self.SetValue(self.defaultValue)
-
+
+ if self.param:
+ self.param['value'] = ''
+
def InsertTableColumns(self, table, driver=None, database=None):
- """!Insert table columns"""
- columns = []
+ """!Insert table columns
+
+ @param table table name
+ @param driver driver name
+ @param database database name
+ """
+ columns = list()
ret = gcmd.RunCommand('db.columns',
read = True,
@@ -715,10 +730,13 @@
if ret:
columns = ret.splitlines()
-
+
self.SetItems(columns)
self.SetValue(self.defaultValue)
+ if self.param:
+ self.param['value'] = ''
+
class LocationSelect(wx.ComboBox):
"""!Widget for selecting GRASS location"""
def __init__(self, parent, id = wx.ID_ANY, size = globalvar.DIALOG_COMBOBOX_SIZE,
Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py 2010-03-13 17:24:27 UTC (rev 41424)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py 2010-03-13 17:35:40 UTC (rev 41425)
@@ -1447,7 +1447,8 @@
win.Bind(wx.EVT_TEXT, self.OnSetValue)
elif p.get('prompt', '') == 'dbcolumn':
win = gselect.ColumnSelect(parent = which_panel,
- value = p.get('default', ''))
+ value = p.get('default', ''),
+ param = p)
win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
win.Bind(wx.EVT_TEXT, self.OnSetValue)
@@ -1665,6 +1666,8 @@
for fn, kwargs in event.data.iteritems():
fn(**kwargs)
+ self.parent.updateValuesHook()
+
def OnVerbosity(self, event):
"""!Verbosity level changed"""
verbose = self.FindWindowById(self.task.get_flag('verbose')['wxId'][0])
More information about the grass-commit
mailing list