[GRASS-SVN] r36250 - in grass/branches/develbranch_6: gui/wxpython/gui_modules vector/v.surf.rst

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 8 08:50:13 EDT 2009


Author: martinl
Date: 2009-03-08 08:50:12 -0400 (Sun, 08 Mar 2009)
New Revision: 36250

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
   grass/branches/develbranch_6/vector/v.surf.rst/main.c
Log:
v.surf.rst: allow layer '0' in wxGUI dialog


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2009-03-08 12:15:47 UTC (rev 36249)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2009-03-08 12:50:12 UTC (rev 36250)
@@ -404,36 +404,37 @@
     def __init__(self, parent,
                  id=wx.ID_ANY, pos=wx.DefaultPosition,
                  size=globalvar.DIALOG_LAYER_SIZE,
-                 vector=None, choices=[], all=False, default=None):
+                 vector=None, choices=[], initial=['1'], default=None):
 
         super(LayerSelect, self).__init__(parent, id, pos=pos, size=size,
                                           choices=choices)
 
-        self.all = all
+        # initial choices (force '1' to be included)
+        self.initial = initial
+        if '1' not in self.initial:
+            self.initial.append('1')
         
-        self.SetName("LayerSelect")
-
         # default value
         self.default = default
-            
+        
+        self.SetName("LayerSelect")
+        
         if len(choices) > 1:
             return
-
+        
         if vector:
             self.InsertLayers(vector)
         else:
-            if all:
-                self.SetItems(['-1', '1'])
-            else:
-                self.SetItems(['1'])
+            self.SetItems(self.initial)
             self.SetStringSelection('1')
         
     def InsertLayers(self, vector):
         """Insert layers for a vector into the layer combobox"""
-        layerchoices = utils.GetVectorNumberOfLayers(vector)
+        layerchoices = []
+        if self.initial:
+            layerchoices = copy.copy(self.initial)
+        layerchoices += utils.GetVectorNumberOfLayers(vector)
         
-        if self.all:
-            layerchoices.insert(0, '-1')
         if len(layerchoices) > 1:
             self.SetItems(layerchoices)
             self.SetStringSelection('1')

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2009-03-08 12:15:47 UTC (rev 36249)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2009-03-08 12:50:12 UTC (rev 36250)
@@ -918,7 +918,7 @@
             tab[section] = wx.ScrolledWindow( parent=self.notebook )
             tab[section].SetScrollRate(10,10)
             tabsizer[section] = wx.BoxSizer(orient=wx.VERTICAL)
-            self.notebook.AddPage( tab[section], text=section )
+            self.notebook.AddPage( tab[section], text=section.replace('_', ' '))
 
         # are we running from command line?
         ### add 'command output' tab regardless standalone dialog
@@ -1166,7 +1166,8 @@
                                               'dbtable',
                                               'dbcolumn',
                                               'layer',
-                                              'layer_all') and \
+                                              'layer_all',
+                                              'layer_zero') and \
                        p.get('element', '') != 'file':
                     if p.get('multiple', 'no') == 'yes':
                         multiple = True
@@ -1200,21 +1201,25 @@
                                              'dbtable',
                                              'dbcolumn',
                                              'layer',
-                                             'layer_all'):
+                                             'layer_all',
+                                             'layer_zero'):
                     if p.get('multiple', 'no') == 'yes':
                         win = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
                                           size=globalvar.DIALOG_TEXTCTRL_SIZE)
                         win.Bind(wx.EVT_TEXT, self.OnSetValue)
                     else:
                         if p.get('prompt', '') in ('layer',
-                                                   'layer_all'):
+                                                   'layer_all',
+                                                   'layer_zero'):
+                            initial = ['1']
                             if p.get('prompt', '') == 'layer_all':
-                                all = True
-                            else:
-                                all = False
+                                initial.insert(0, '-1')
+                            if p.get('prompt', '') == 'layer_zero':
+                                initial.insert(0, '0')
+                            
                             if p.get('age', 'old_layer') == 'old_layer':
                                 win = gselect.LayerSelect(parent=which_panel,
-                                                          all=all,
+                                                          initial=initial,
                                                           default=p['default'])
                                 p['wxGetValue'] = win.GetStringSelection
                                 win.Bind(wx.EVT_CHOICE, self.OnUpdateSelection)

Modified: grass/branches/develbranch_6/vector/v.surf.rst/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.surf.rst/main.c	2009-03-08 12:15:47 UTC (rev 36249)
+++ grass/branches/develbranch_6/vector/v.surf.rst/main.c	2009-03-08 12:50:12 UTC (rev 36250)
@@ -205,6 +205,7 @@
     parm.field->description =
 	_("If set to 0, z coordinates are used. (3D vector only)");
     parm.field->answer = "1";
+    parm.field->gisprompt = "old_layer,layer,layer_zero";
 
     parm.zcol = G_define_option();
     parm.zcol->key = "zcolumn";



More information about the grass-commit mailing list