[GRASS-SVN] r45595 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Mar 7 07:00:22 EST 2011
Author: martinl
Date: 2011-03-07 04:00:22 -0800 (Mon, 07 Mar 2011)
New Revision: 45595
Modified:
grass/trunk/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI: fix Gdal import dialog (ext patterns)
(merge r45593 from trunk)
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-03-07 11:24:02 UTC (rev 45594)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-03-07 12:00:22 UTC (rev 45595)
@@ -1115,9 +1115,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 = '',
@@ -1253,8 +1253,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):
@@ -1340,7 +1347,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 += ' (*.*)|*.*'
@@ -1425,7 +1432,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))
@@ -1485,7 +1492,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