[GRASS-SVN] r33883 - in grass/trunk: gui/wxpython/gui_modules scripts/v.dissolve

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 15 01:51:22 EDT 2008


Author: martinl
Date: 2008-10-15 01:51:22 -0400 (Wed, 15 Oct 2008)
New Revision: 33883

Modified:
   grass/trunk/gui/wxpython/gui_modules/gselect.py
   grass/trunk/gui/wxpython/gui_modules/menuform.py
   grass/trunk/scripts/v.dissolve/v.dissolve
   grass/trunk/scripts/v.dissolve/v.dissolve.py
Log:
wxGUI: support for layer_all ('-1' for all layers)
(merge from devbr6, r33881)


Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py	2008-10-15 05:48:52 UTC (rev 33882)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py	2008-10-15 05:51:22 UTC (rev 33883)
@@ -421,10 +421,13 @@
     def __init__(self, parent,
                  id=wx.ID_ANY, pos=wx.DefaultPosition,
                  size=globalvar.DIALOG_LAYER_SIZE,
-                 vector=None, choices=[]):
+                 vector=None, choices=[], all=False):
 
         super(LayerSelect, self).__init__(parent, id, pos=pos, size=size,
                                           choices=choices)
+
+        self.all = all
+        
         self.SetName("LayerSelect")
 
         if len(choices) > 1:
@@ -433,19 +436,24 @@
         if vector:
             self.InsertLayers(vector)
         else:
-            self.SetItems(['1'])
-            self.SetSelection(0)
+            if all:
+                self.SetItems(['-1', '1'])
+            else:
+                self.SetItems(['1'])
+            self.SetStringSelection('1')
         
     def InsertLayers(self, vector):
         """Insert layers for a vector into the layer combobox"""
         layerchoices = VectorDBInfo(vector).layers.keys()
         
+        if self.all:
+            layerchoices.insert(0, '-1')
         if len(layerchoices) > 1:
             self.SetItems(map(str, layerchoices))
             self.SetStringSelection('1')
         else:
             self.SetItems(['1'])
-            self.SetSelection(0)
+            self.SetStringSelection('1')
 
 class TableSelect(wx.ComboBox):
     """

Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-10-15 05:48:52 UTC (rev 33882)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-10-15 05:51:22 UTC (rev 33883)
@@ -1135,7 +1135,8 @@
                                               'color_none',
                                               'dbcolumn',
                                               'dbtable',
-                                              'layer') and \
+                                              'layer',
+                                              'layer_all') and \
                        p.get('element', '') != 'file':
                     if p.get('multiple', 'no') == 'yes':
                         multiple = True
@@ -1166,9 +1167,16 @@
                 # layer, dbcolumn, dbtable entry
                 elif p.get('prompt', '') in ('dbcolumn',
                                              'dbtable',
-                                             'layer'):
-                    if p.get('prompt', '') == 'layer':
-                        win = gselect.LayerSelect(parent=which_panel)
+                                             'layer',
+                                             'layer_all'):
+                    if p.get('prompt', '') in ('layer',
+                                               'layer_all'):
+                        if p.get('prompt', '') == 'layer_all':
+                            all = True
+                        else:
+                            all = False
+                        win = gselect.LayerSelect(parent=which_panel,
+                                                  all=all)
                         p['wxGetValue'] = win.GetStringSelection
                         win.Bind(wx.EVT_CHOICE, self.OnUpdateSelection)
                         win.Bind(wx.EVT_CHOICE, self.OnSetValue)

Modified: grass/trunk/scripts/v.dissolve/v.dissolve
===================================================================
--- grass/trunk/scripts/v.dissolve/v.dissolve	2008-10-15 05:48:52 UTC (rev 33882)
+++ grass/trunk/scripts/v.dissolve/v.dissolve	2008-10-15 05:51:22 UTC (rev 33883)
@@ -37,8 +37,10 @@
 #%option
 #% key: layer
 #% type: integer
-#% description: Layer number. If -1, all layers are extracted
+#% label: Layer number. If -1, all layers are extracted.
+#% description: A single vector map can be connected to multiple database tables. This number determines which table to use.
 #% answer: 1
+#% gisprompt: old_layer,layer,layer_all
 #% required : no
 #%end
 #%option
@@ -46,6 +48,7 @@
 #% type: string
 #% description: Name of column used to dissolve common boundaries
 #% required : no
+#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
 #%end
 
 if  [ -z "$GISBASE" ] ; then

Modified: grass/trunk/scripts/v.dissolve/v.dissolve.py
===================================================================
--- grass/trunk/scripts/v.dissolve/v.dissolve.py	2008-10-15 05:48:52 UTC (rev 33882)
+++ grass/trunk/scripts/v.dissolve/v.dissolve.py	2008-10-15 05:51:22 UTC (rev 33883)
@@ -38,14 +38,17 @@
 #%option
 #% key: layer
 #% type: integer
-#% description: Layer number. If -1, all layers are extracted
+#% label: Layer number. If -1, all layers are extracted.
+#% description: A single vector map can be connected to multiple database tables. This number determines which table to use.
 #% answer: 1
+#% gisprompt: old_layer,layer,layer_all
 #% required : no
 #%end
 #%option
 #% key: column
 #% type: string
 #% description: Name of column used to dissolve common boundaries
+#% gisprompt: old_dbcolumn,dbcolumn,dbcolumn
 #% required : no
 #%end
 



More information about the grass-commit mailing list