[GRASS-SVN] r33876 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 14 13:31:00 EDT 2008


Author: martinl
Date: 2008-10-14 13:31:00 -0400 (Tue, 14 Oct 2008)
New Revision: 33876

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: update dialog for dbtable 


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2008-10-14 16:09:59 UTC (rev 33875)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2008-10-14 17:31:00 UTC (rev 33876)
@@ -443,6 +443,33 @@
         else:
             self.SetItems(['1'])
             self.SetSelection(0)
+
+class TableSelect(wx.ComboBox):
+    """
+    Creates combo box for selecting attribute tables from the database
+    """
+    def __init__(self, parent,
+                 id=wx.ID_ANY, value='', pos=wx.DefaultPosition,
+                 size=globalvar.DIALOG_COMBOBOX_SIZE,
+                 choices=[]):
+
+        super(TableSelect, self).__init__(parent, id, value, pos, size, choices,
+                                          style=wx.CB_READONLY)
+
+        self.SetName("TableSelect")
+
+        if not choices:
+            self.InsertTables()
+                
+    def InsertTables(self):
+        """Insert attribute tables into combobox"""
+        items = []
+        for table in gcmd.Command(['db.tables',
+                                   '-p']).ReadStdOutput():
+            items.append(table)
+            
+        self.SetItems(items)
+        self.SetValue('')
         
 class ColumnSelect(wx.ComboBox):
     """

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2008-10-14 16:09:59 UTC (rev 33875)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2008-10-14 17:31:00 UTC (rev 33876)
@@ -1171,6 +1171,10 @@
                         p['wxGetValue'] = win.GetStringSelection
                         win.Bind(wx.EVT_CHOICE, self.OnUpdateSelection)
                         win.Bind(wx.EVT_CHOICE, self.OnSetValue)
+                    elif p.get('prompt', '') == 'dbtable':
+                        win = gselect.TableSelect(parent=which_panel)
+                        p['wxGetValue'] = win.GetStringSelection
+                        win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                     else:
                         win = gselect.ColumnSelect(parent=which_panel)
                         p['wxGetValue'] = win.GetStringSelection



More information about the grass-commit mailing list