[GRASS-SVN] r46851 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 29 10:11:03 EDT 2011
Author: mmetz
Date: 2011-06-29 07:11:03 -0700 (Wed, 29 Jun 2011)
New Revision: 46851
Modified:
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
improve vector layer selection
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-06-29 13:54:35 UTC (rev 46850)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-06-29 14:11:03 UTC (rev 46851)
@@ -646,8 +646,6 @@
def InsertLayers(self, vector = None, dsn = None):
"""!Insert layers for a vector into the layer combobox
- @todo Implement native format
-
@param vector vector map name (native or connected via v.external)
@param dsn OGR data source name
"""
@@ -656,7 +654,10 @@
layers.append('-1')
if vector:
- # TODO
+ # TODO: use Vect_get_field2() in C modules where possible
+ # currently the following is identical to
+ # layers = utils.GetVectorNumberOfLayers(self, vector)
+
ret = gcmd.RunCommand('v.db.connect',
read = True,
quiet = True,
@@ -672,7 +673,7 @@
# which is not the case right now
### layers.append(layername[len(layername) - 1])
layers.append(layername[0])
-
+
elif dsn:
ret = gcmd.RunCommand('v.in.ogr',
read = True,
@@ -682,13 +683,14 @@
if ret:
layers = ret.splitlines()
- if len(layers) == 0:
- if self.default == None:
- layers.append('')
- else:
+ if self.default:
+ if len(layers) == 0:
+ layers.insert(0, str(self.default))
+ elif self.default not in layers:
layers.append(self.default)
- self.SetItems(layers)
- #self.SetSelection(0)
+
+ if len(layers) > 0:
+ self.SetItems(layers)
class DriverSelect(wx.ComboBox):
"""!Creates combo box for selecting database driver.
Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py 2011-06-29 13:54:35 UTC (rev 46850)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py 2011-06-29 14:11:03 UTC (rev 46851)
@@ -1239,13 +1239,13 @@
default = p['default'])
win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
win.Bind(wx.EVT_TEXT, self.OnSetValue)
+ win.SetValue(str(value)) # default or previously set value
else:
win = wx.SpinCtrl(parent = which_panel, id = wx.ID_ANY,
min = 1, max = 100, initial = int(p['default']))
win.Bind(wx.EVT_SPINCTRL, self.OnSetValue)
+ win.SetValue(int(value)) # default or previously set value
- win.SetValue(str(value))
-
p['wxId'] = [ win.GetId() ]
elif p.get('prompt', '') == 'dbdriver':
More information about the grass-commit
mailing list