[GRASS-SVN] r44555 -
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Dec 7 09:13:19 EST 2010
Author: martinl
Date: 2010-12-07 06:13:19 -0800 (Tue, 07 Dec 2010)
New Revision: 44555
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI: ext pattern in import dialog case insensitive
(merge r44554 from devbr6)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py 2010-12-07 14:07:40 UTC (rev 44554)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gdialogs.py 2010-12-07 14:13:19 UTC (rev 44555)
@@ -1165,6 +1165,8 @@
else: # gdal
if self.dsnInput.GetType() == 'dir':
idsn = os.path.join(dsn, layer)
+ else:
+ idsn = dsn
if self.link:
cmd = ['r.external',
@@ -1321,7 +1323,7 @@
self.SetStringItem(index, 1, "%s" % str(name))
self.SetStringItem(index, 2, "%s" % str(grassName))
# check by default
- ### self.CheckItem(index, True)
+ self.CheckItem(index, True)
self.SetColumnWidth(col=0, width=wx.LIST_AUTOSIZE_USEHEADER)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py 2010-12-07 14:07:40 UTC (rev 44554)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py 2010-12-07 14:13:19 UTC (rev 44555)
@@ -967,13 +967,13 @@
# dsn widgets
if not ogr:
- filemask = 'GeoTIFF (*.tif)|*.tif'
+ filemask = 'GeoTIFF (*.tif)|*.%s' % self._getExtPattern('tif')
else:
- filemask = 'ESRI Shapefile (*.shp)|*.shp'
+ filemask = 'ESRI Shapefile (*.shp)|*.%s' % self._getExtPattern('shp')
dsnFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY,
size=globalvar.DIALOG_GSELECT_SIZE, labelText = '',
- dialogTitle=_('Choose input file'),
+ dialogTitle=_('Choose file to import'),
buttonText=_('Browse'),
startDirectory=os.getcwd(),
changeCallback=self.OnSetDsn,
@@ -1088,14 +1088,21 @@
self.SetSizer(mainSizer)
mainSizer.Fit(self)
-
+
+ def _getExtPattern(self, ext):
+ """!Get pattern for case-insensitive mask"""
+ pattern = ''
+ for c in ext:
+ pattern += '[' + c + c.upper() + ']'
+
+ return pattern
+
def OnSetType(self, event):
"""!Datasource type changed"""
sel = event.GetSelection()
win = self.input[self.dsnType][1]
self.dsnSizer.Remove(win)
win.Hide()
-
if sel == self.sourceMap['file']: # file
self.dsnType = 'file'
format = self.input[self.dsnType][2][0]
@@ -1103,13 +1110,14 @@
ext = self.format.GetExtension(format)
if not ext:
raise KeyError
- format += ' (*.%s)|*.%s' % (ext, ext)
+ format += ' (*.%s)|*.%s' % (ext, self._getExtPattern(ext))
+ print format
except KeyError:
format += ' (*.*)|*.*'
win = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY,
size=globalvar.DIALOG_GSELECT_SIZE, labelText='',
- dialogTitle=_('Choose input file'),
+ dialogTitle=_('Choose file to import'),
buttonText=_('Browse'),
startDirectory=os.getcwd(),
changeCallback=self.OnSetDsn,
@@ -1172,7 +1180,7 @@
ext = self.format.GetExtension(self.format.GetStringSelection())
except KeyError:
ext = ''
- for file in glob.glob(os.path.join(dsn, "*.%s") % ext):
+ for file in glob.glob(os.path.join(dsn, "*.%s") % self._getExtPattern(ext)):
baseName = os.path.basename(file)
grassName = utils.GetValidLayerName(baseName.split('.', -1)[0])
data.append((layerId, baseName, grassName))
@@ -1228,7 +1236,7 @@
ext = self.format.GetExtension(format)
if not ext:
raise KeyError
- format += ' (*.%s)|*.%s' % (ext, ext)
+ format += ' (*.%s)|*.%s' % (ext, self._getExtPattern(ext))
except KeyError:
format += ' (*.*)|*.*'
More information about the grass-commit
mailing list