[GRASS-SVN] r53546 - in grass/branches/develbranch_6/gui/wxpython: core gui_core

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


Author: martinl
Date: 2012-10-24 10:13:08 -0700 (Wed, 24 Oct 2012)
New Revision: 53546

Modified:
   grass/branches/develbranch_6/gui/wxpython/core/utils.py
   grass/branches/develbranch_6/gui/wxpython/gui_core/gselect.py
Log:
wxGUI: fix when GDAL support is missing
       (merge r53545 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/core/utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/utils.py	2012-10-24 17:10:39 UTC (rev 53545)
+++ grass/branches/develbranch_6/gui/wxpython/core/utils.py	2012-10-24 17:13:08 UTC (rev 53546)
@@ -701,18 +701,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)
 
 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)
 
 def _parseFormats(output):

Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/gselect.py	2012-10-24 17:10:39 UTC (rev 53545)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/gselect.py	2012-10-24 17:13:08 UTC (rev 53546)
@@ -1508,8 +1508,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