Browse Source

wxGUI: fix running `d.* --help`
add d.redraw to supported commands


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48599 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 13 years ago
parent
commit
2459834609
2 changed files with 12 additions and 6 deletions
  1. 5 2
      gui/wxpython/gui_modules/goutput.py
  2. 7 4
      gui/wxpython/gui_modules/menuform.py

+ 5 - 2
gui/wxpython/gui_modules/goutput.py

@@ -480,7 +480,7 @@ class GMConsole(wx.SplitterWindow):
             # except display commands (they are handled differently)
             if self.parent.GetName() == "LayerManager" and \
                     command[0][0:2] == "d." and \
-                    (len(command) > 1 and 'help' not in ' '.join(command[1:])):
+                    'help' not in ' '.join(command[1:]):
                 # display GRASS commands
                 try:
                     layertype = {'d.rast'         : 'raster',
@@ -499,7 +499,8 @@ class GMConsole(wx.SplitterWindow):
                                  'd.geodesic'     : 'geodesic',
                                  'd.rhumbline'    : 'rhumb',
                                  'd.labels'       : 'labels',
-                                 'd.barscale'     : 'barscale'}[command[0]]
+                                 'd.barscale'     : 'barscale',
+                                 'd.redraw'       : 'redraw'}[command[0]]
                 except KeyError:
                     gcmd.GMessage(parent = self.parent,
                                   message = _("Command '%s' not yet implemented in the WxGUI. "
@@ -510,6 +511,8 @@ class GMConsole(wx.SplitterWindow):
                     self.parent.curr_page.maptree.GetMapDisplay().OnAddBarscale(None)
                 elif layertype == 'rastleg':
                     self.parent.curr_page.maptree.GetMapDisplay().OnAddLegend(None)
+                elif layertype == 'redraw':
+                    self.parent.curr_page.maptree.GetMapDisplay().OnRender(None)
                 else:
                     # add layer into layer tree
                     lname, found = utils.GetLayerNameFromCmd(command, fullyQualified = True,

+ 7 - 4
gui/wxpython/gui_modules/menuform.py

@@ -1938,11 +1938,14 @@ class GUI:
                     try:
                         key, value = option.split('=', 1)
                     except:
-                        if i == 0: # add key name of first parameter if not given
-                            key = self.grass_task.firstParam
-                            value = option
+                        if self.grass_task.firstParam:
+                            if i == 0: # add key name of first parameter if not given
+                                key = self.grass_task.firstParam
+                                value = option
+                            else:
+                                raise gcmd.GException, _("Unable to parse command '%s'") % ' '.join(cmd)
                         else:
-                            raise gcmd.GException, _("Unable to parse command '%s'") % ' '.join(cmd)
+                            continue
                     
                     element = self.grass_task.get_param(key, raiseError = False)
                     if not element: