[GRASS-SVN] r45593 -
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 7 06:14:13 EST 2011
Author: martinl
Date: 2011-03-07 03:14:13 -0800 (Mon, 07 Mar 2011)
New Revision: 45593
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI: fix Gdal import dialog (ext patterns)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py 2011-03-06 23:45:53 UTC (rev 45592)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gselect.py 2011-03-07 11:14:13 UTC (rev 45593)
@@ -1071,9 +1071,9 @@
# dsn widgets
if not ogr:
- filemask = 'GeoTIFF (*.tif)|*.%s' % self._getExtPattern('tif')
+ filemask = 'GeoTIFF (%s)|%s' % (self._getExtPattern('tif'), self._getExtPattern('tif'))
else:
- filemask = 'ESRI Shapefile (*.shp)|*.%s' % self._getExtPattern('shp')
+ filemask = 'ESRI Shapefile (%s)|%s' % (self._getExtPattern('shp'), self._getExtPattern('shp'))
dsnFile = filebrowse.FileBrowseButton(parent=self, id=wx.ID_ANY,
size=globalvar.DIALOG_GSELECT_SIZE, labelText = '',
@@ -1209,8 +1209,15 @@
self.SetSizer(mainSizer)
mainSizer.Fit(self)
+ def _getExtPatternGlob(self, ext):
+ """!Get pattern for case-insensitive globing"""
+ pattern = '*.'
+ for c in ext:
+ pattern += '[%s%s]' % (c.lower(), c.upper())
+ return pattern
+
def _getExtPattern(self, ext):
- """!Get pattern for case-insensitive mask"""
+ """!Get pattern for case-insensitive file mask"""
return '*.%s;*.%s' % (ext.lower(), ext.upper())
def OnSettingsLoad(self, event):
@@ -1296,7 +1303,7 @@
ext = self.format.GetExtension(format)
if not ext:
raise KeyError
- format += ' (*.%s)|*.%s' % (ext, self._getExtPattern(ext))
+ format += ' (%s)|%s' % (self._getExtPattern(ext), self._getExtPattern(ext))
except KeyError:
format += ' (*.*)|*.*'
@@ -1381,7 +1388,7 @@
ext = self.format.GetExtension(self.format.GetStringSelection())
except KeyError:
ext = ''
- for file in glob.glob(os.path.join(dsn, "*.%s") % self._getExtPattern(ext)):
+ for file in glob.glob(os.path.join(dsn, "%s") % self._getExtPatternGlob(ext)):
baseName = os.path.basename(file)
grassName = utils.GetValidLayerName(baseName.split('.', -1)[0])
data.append((layerId, baseName, grassName))
@@ -1441,7 +1448,7 @@
ext = self.format.GetExtension(format)
if not ext:
raise KeyError
- format += ' (*.%s)|*.%s' % (ext, self._getExtPattern(ext))
+ format += ' (%s)|%s' % (self._getExtPattern(ext), self._getExtPattern(ext))
except KeyError:
format += ' (*.*)|*.*'
More information about the grass-commit
mailing list