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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 13 13:21:08 EST 2010


Author: martinl
Date: 2010-03-13 13:21:07 -0500 (Sat, 13 Mar 2010)
New Revision: 41427

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: be more consistent on ColumnSelect events
(merge r41425 from trunk)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py	2010-03-13 17:50:01 UTC (rev 41426)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py	2010-03-13 18:21:07 UTC (rev 41427)
@@ -570,27 +570,35 @@
         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 **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 = '',
                  size = globalvar.DIALOG_COMBOBOX_SIZE,
-                 vector = None, layer = 1, choices = [], readonly = False,
+                 vector = None, layer = 1, choices = [], readonly = False, param = None,
                  **kwargs):
         if readonly:
             if kwargs.has_key('style'):
                 style |= wx.CB_READONLY
             else:
                 style = wx.CB_READONLY
+        
         self.defaultValue = value
+        self.param = param
         
         super(ColumnSelect, self).__init__(parent, id, value = value, choices = choices, size = size,
                                            **kwargs)
+        self.SetName("ColumnSelect")
         
-        self.SetName("ColumnSelect")
-
         if vector:
             self.InsertColumns(vector, layer)
     
@@ -605,14 +613,22 @@
             for key, val in columnchoices.iteritems():
                 columns[val['index']] = 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
 
-    def InsertTableColumns(self, table, driver=None, database=None):
-        """Insert table columns"""
-        columns = []
+        @param table table name
+        @param driver driver name
+        @param database database name
+        """
+        columns = list()
         
         ret = gcmd.RunCommand('db.columns',
                               read = True,
@@ -622,10 +638,13 @@
         
         if ret:
             columns = ret.splitlines()
-
+        
         self.SetItems(columns)
         self.SetValue(self.defaultValue)
         
+        if self.param:
+            self.param['value'] = ''
+        
 class DbColumnSelect(wx.ComboBox):
     """
     Creates combo box for selecting columns from any table.
@@ -633,7 +652,7 @@
     def __init__(self, parent,
                  id=wx.ID_ANY, value='', pos=wx.DefaultPosition,
                  size=wx.DefaultSize, choices=[''], **kargs):
-
+        
         super(ColumnSelect, self).__init__(parent, id, value, pos, size, choices)
 
         dbtable = kargs['table'] # table to check for columns

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py	2010-03-13 17:50:01 UTC (rev 41426)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py	2010-03-13 18:21:07 UTC (rev 41427)
@@ -1410,7 +1410,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)
                             ### p['wxGetValue'] = win.GetStringSelection
                             ### win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                             win.Bind(wx.EVT_TEXT, self.OnSetValue)
@@ -1580,6 +1581,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'])



More information about the grass-commit mailing list