Browse Source

wxGUI: better error handling when command is not available

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49741 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 years ago
parent
commit
29191b7932
2 changed files with 8 additions and 5 deletions
  1. 2 3
      gui/wxpython/gui_core/forms.py
  2. 6 2
      gui/wxpython/gui_core/goutput.py

+ 2 - 3
gui/wxpython/gui_core/forms.py

@@ -1968,9 +1968,8 @@ class GUI:
             global _blackList
             self.grass_task = gtask.parse_interface(cmd[0],
                                                     blackList = _blackList)
-        except ValueError, e: #grass.ScriptError, e:
-            GError(e.value)
-            return
+        except (grass.ScriptError, ValueError), e: 
+            raise gcmd.GException(e.value)
         
         # if layer parameters previously set, re-insert them into dialog
         if completed is not None:

+ 6 - 2
gui/wxpython/gui_core/goutput.py

@@ -537,7 +537,10 @@ class GMConsole(wx.SplitterWindow):
                 # other GRASS commands (r|v|g|...)
                 if len(command) == 1 and command[0] != 'v.krige':
                     # no arguments given
-                    GUI(parent = self).ParseCommand(command)
+                    try:
+                        GUI(parent = self).ParseCommand(command)
+                    except GException, e:
+                        print >> sys.stderr, e
                     return 0
                 
                 task = GUI(show = None).ParseCommand(command)
@@ -818,7 +821,8 @@ class GMConsole(wx.SplitterWindow):
             
             try:
                 task = GUI(show = None).ParseCommand(event.cmd)
-            except GException:
+            except GException, e:
+                print >> sys.stderr, e
                 task = None
                 return