[GRASS-SVN] r50569 - in grass/branches/develbranch_6: gui/wxpython/core gui/wxpython/gui_core lib/python

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 30 15:22:25 EST 2012


Author: martinl
Date: 2012-01-30 12:22:25 -0800 (Mon, 30 Jan 2012)
New Revision: 50569

Modified:
   grass/branches/develbranch_6/gui/wxpython/core/gcmd.py
   grass/branches/develbranch_6/gui/wxpython/gui_core/forms.py
   grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py
   grass/branches/develbranch_6/lib/python/core.py
   grass/branches/develbranch_6/lib/python/task.py
Log:
wxGUI: attempt to catch error when getting interface description

Modified: grass/branches/develbranch_6/gui/wxpython/core/gcmd.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/gcmd.py	2012-01-30 20:15:37 UTC (rev 50568)
+++ grass/branches/develbranch_6/gui/wxpython/core/gcmd.py	2012-01-30 20:22:25 UTC (rev 50569)
@@ -146,7 +146,7 @@
         self.value = value
 
     def __str__(self):
-        return str(self.value)
+        return self.value
 
 class Popen(subprocess.Popen):
     """!Subclass subprocess.Popen"""

Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/forms.py	2012-01-30 20:15:37 UTC (rev 50568)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/forms.py	2012-01-30 20:22:25 UTC (rev 50569)
@@ -1835,8 +1835,8 @@
             global _blackList
             self.grass_task = gtask.parse_interface(gcmd.GetRealCmd(cmd[0]),
                                                     blackList = _blackList)
-        except (grass.ScriptError, ValueError), e: 
-            raise gcmd.GException(e.value)
+        except (grass.ScriptError, ValueError), e:
+            raise gcmd.GException(e)
         
         # if layer parameters previously set, re-insert them into dialog
         if completed is not None:

Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py	2012-01-30 20:15:37 UTC (rev 50568)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/goutput.py	2012-01-30 20:22:25 UTC (rev 50569)
@@ -524,7 +524,14 @@
                 # other GRASS commands (r|v|g|...)
                 hasParams = False
                 if command[0] != 'r.mapcalc':
-                    task = GUI(show = None).ParseCommand(command)
+                    try:
+                        task = GUI(show = None).ParseCommand(command)
+                    except GException, e:
+                        GError(parent = self,
+                               message = unicode(e),
+                               showTraceback = False)
+                        return
+                    
                     if task:
                         options = task.get_options()
                         hasParams = options['params'] and options['flags']

Modified: grass/branches/develbranch_6/lib/python/core.py
===================================================================
--- grass/branches/develbranch_6/lib/python/core.py	2012-01-30 20:15:37 UTC (rev 50568)
+++ grass/branches/develbranch_6/lib/python/core.py	2012-01-30 20:22:25 UTC (rev 50569)
@@ -61,9 +61,9 @@
 class ScriptError(Exception):
     def __init__(self, msg):
         self.value = msg
-    
+        
     def __str__(self):
-        return repr(self.value)
+        return self.value
         
 raise_on_error = False # raise exception instead of calling fatal()
 debug_level = 0        # DEBUG level

Modified: grass/branches/develbranch_6/lib/python/task.py
===================================================================
--- grass/branches/develbranch_6/lib/python/task.py	2012-01-30 20:15:37 UTC (rev 50568)
+++ grass/branches/develbranch_6/lib/python/task.py	2012-01-30 20:22:25 UTC (rev 50569)
@@ -439,7 +439,9 @@
         
         cmdout, cmderr = Popen(args, stdout = PIPE,
                                stderr = PIPE).communicate()
-        
+        if cmderr:
+            raise ScriptError, _("Unable to fetch interface description for command '%(cmd)s'."
+                                 "\n\nDetails: %(det)s") % { 'cmd' : cmd, 'det' : decode(cmderr) }
     except OSError, e:
         raise ScriptError, _("Unable to fetch interface description for command '%(cmd)s'."
                              "\n\nDetails: %(det)s") % { 'cmd' : cmd, 'det' : e }



More information about the grass-commit mailing list