[GRASS-SVN] r42055 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 28 15:27:09 EDT 2010
Author: martinl
Date: 2010-04-28 15:27:09 -0400 (Wed, 28 Apr 2010)
New Revision: 42055
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI: fix GdalSelect in menuform
(merge r42054 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2010-04-28 19:23:59 UTC (rev 42054)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2010-04-28 19:27:09 UTC (rev 42055)
@@ -867,9 +867,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
@@ -883,6 +882,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,
@@ -911,6 +932,7 @@
buttonText=_('Browse'),
startDirectory=os.getcwd(),
changeCallback=self.OnSetDsn)
+ dsnDir.SetName('GdalSelect')
dsnDir.Hide()
dsnDbFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY,
@@ -959,7 +981,7 @@
'choice' : dsnDbChoice },
}
- self.dsnType = defSource
+ self.dsnType = default
self.input[self.dsnType][1].Show()
self.format.SetItems(self.input[self.dsnType][2])
@@ -1014,7 +1036,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:
@@ -1033,17 +1055,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,
More information about the grass-commit
mailing list