[GRASS-SVN] r42054 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 28 15:24:00 EDT 2010
Author: martinl
Date: 2010-04-28 15:23:59 -0400 (Wed, 28 Apr 2010)
New Revision: 42054
Modified:
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: fix GdalSelect in menuform
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2010-04-28 17:14:22 UTC (rev 42053)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2010-04-28 19:23:59 UTC (rev 42054)
@@ -908,9 +908,8 @@
class GdalSelect(wx.Panel):
def __init__(self, parent, panel, ogr = False,
- defSource = 'file',
- sources = [_("File"), _("Directory"),
- _("Database"), _("Protocol")],
+ default = 'file',
+ exclude = [],
envHandler = None):
"""!Widget for selecting GDAL/OGR datasource, format
@@ -924,6 +923,28 @@
label=" %s " % _("Source name"))
# source type
+ sources = list()
+ self.sourceMap = { 'file' : -1,
+ 'dir' : -1,
+ 'db' : -1,
+ 'pro' : -1 }
+ idx = 0
+ if 'file' not in exclude:
+ sources.append(_("File"))
+ self.sourceMap['file'] = idx
+ idx += 1
+ if 'directory' not in exclude:
+ sources.append(_("Directory"))
+ self.sourceMap['dir'] = idx
+ idx += 1
+ if 'database' not in exclude:
+ sources.append(_("Database"))
+ self.sourceMap['db'] = idx
+ idx += 1
+ if 'protocol' not in exclude:
+ sources.append(_("Protocol"))
+ self.sourceMap['pro'] = idx
+
self.source = wx.RadioBox(parent = self, id = wx.ID_ANY,
label = _('Source type'),
style = wx.RA_SPECIFY_COLS,
@@ -952,6 +973,7 @@
buttonText=_('Browse'),
startDirectory=os.getcwd(),
changeCallback=self.OnSetDsn)
+ dsnDir.SetName('GdalSelect')
dsnDir.Hide()
dsnDbFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY,
@@ -1000,7 +1022,7 @@
'choice' : dsnDbChoice },
}
- self.dsnType = defSource
+ self.dsnType = default
self.input[self.dsnType][1].Show()
self.format.SetItems(self.input[self.dsnType][2])
@@ -1055,7 +1077,7 @@
self.dsnSizer.Remove(win)
win.Hide()
- if sel == 0: # file
+ if sel == self.sourceMap['file']: # file
self.dsnType = 'file'
format = self.input[self.dsnType][2][0]
try:
@@ -1074,17 +1096,13 @@
changeCallback=self.OnSetDsn,
fileMask = format)
self.input[self.dsnType][1] = win
- elif sel == 1: # directory
+ elif sel == self.sourceMap['dir']: # directory
self.dsnType = 'dir'
- elif sel == 2: # database
+ elif sel == self.sourceMap['db']: # database
self.dsnType = 'db'
- elif sel == 3: # protocol
+ elif sel == self.sourceMap['pro']: # protocol
self.dsnType = 'pro'
-
- # if self.importType != 'dxf':
- # self.dsnSizer.Add(item=self.formatText,
- # flag=wx.ALIGN_CENTER_VERTICAL)
-
+
win = self.input[self.dsnType][1]
self.dsnSizer.Add(item=self.input[self.dsnType][1],
flag = wx.ALIGN_CENTER_VERTICAL | wx.EXPAND,
Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py 2010-04-28 17:14:22 UTC (rev 42053)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py 2010-04-28 19:23:59 UTC (rev 42054)
@@ -1419,9 +1419,8 @@
border=5)
ogrSelection = gselect.GdalSelect(parent = self, panel = which_panel, ogr = True,
- defSource = 'dir',
- sources = [_("Directory"),
- _("Database"), _("Protocol")])
+ default = 'dir',
+ exclude = ['file'])
self.Bind(gselect.EVT_GDALSELECT, self.OnUpdateSelection)
self.Bind(gselect.EVT_GDALSELECT, self.OnSetValue)
@@ -1489,7 +1488,7 @@
win2.SetItems([p['value']])
win2.SetSelection(0)
- win2.Bind(wx.EVT_TEXT, self.OnSetValue)
+ win2.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
p['wxId'] = [ win1.GetId(), win2.GetId() ]
win.Add(item = win1, proportion = 0)
win.Add(item = win2, proportion = 0,
@@ -1877,6 +1876,7 @@
myId = event.GetId()
me = wx.FindWindowById(myId)
name = me.GetName()
+
for porf in self.task.params + self.task.flags:
if 'wxId' in porf:
found = False
@@ -1892,7 +1892,7 @@
else:
porf['value'] = me.GetValue()
- if name == 'OgrSelect':
+ if name == 'GdalSelect':
porf['value'] += '@OGR'
self.OnUpdateValues()
More information about the grass-commit
mailing list