[GRASS-SVN] r53545 - in grass/trunk/gui/wxpython: core gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Oct 24 10:10:41 PDT 2012


Author: martinl
Date: 2012-10-24 10:10:39 -0700 (Wed, 24 Oct 2012)
New Revision: 53545

Modified:
   grass/trunk/gui/wxpython/core/utils.py
   grass/trunk/gui/wxpython/gui_core/gselect.py
Log:
wxGUI: fix when GDAL support is missing


Modified: grass/trunk/gui/wxpython/core/utils.py
===================================================================
--- grass/trunk/gui/wxpython/core/utils.py	2012-10-24 15:41:24 UTC (rev 53544)
+++ grass/trunk/gui/wxpython/core/utils.py	2012-10-24 17:10:39 UTC (rev 53545)
@@ -664,18 +664,24 @@
 
 def _getGDALFormats():
     """!Get dictionary of avaialble GDAL drivers"""
-    ret = grass.read_command('r.in.gdal',
-                             quiet = True,
-                             flags = 'f')
+    try:
+        ret = grass.read_command('r.in.gdal',
+                                 quiet = True,
+                                 flags = 'f')
+    except:
+        ret = None
     
     return _parseFormats(ret), _parseFormats(ret, writableOnly = True)
 
 def _getOGRFormats():
     """!Get dictionary of avaialble OGR drivers"""
-    ret = grass.read_command('v.in.ogr',
-                             quiet = True,
-                             flags = 'f')
-    
+    try:
+        ret = grass.read_command('v.in.ogr',
+                                 quiet = True,
+                                 flags = 'f')
+    except:
+        ret = None
+
     return _parseFormats(ret), _parseFormats(ret, writableOnly = True)
 
 def _parseFormats(output, writableOnly = False):

Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py	2012-10-24 15:41:24 UTC (rev 53544)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py	2012-10-24 17:10:39 UTC (rev 53545)
@@ -1537,8 +1537,11 @@
         
         if sel == self.sourceMap['file']:   # file
             self.dsnType = 'file'
-            format = self.input[self.dsnType][2][0]
             try:
+                format = self.input[self.dsnType][2][0]
+            except IndexError:
+                format = ''
+            try:
                 ext = self.format.GetExtension(format)
                 if not ext:
                     raise KeyError



More information about the grass-commit mailing list