[GRASS-SVN] r48600 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 2 17:35:49 EDT 2011


Author: martinl
Date: 2011-10-02 14:35:49 -0700 (Sun, 02 Oct 2011)
New Revision: 48600

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: fix running `d.* --help`
      add d.redraw to supported commands
      (merge r48598 from devr6)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2011-10-02 21:22:11 UTC (rev 48599)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2011-10-02 21:35:49 UTC (rev 48600)
@@ -472,7 +472,7 @@
             # 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',
@@ -490,7 +490,8 @@
                                  '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. "
@@ -501,6 +502,8 @@
                     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,

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py	2011-10-02 21:22:11 UTC (rev 48599)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py	2011-10-02 21:35:49 UTC (rev 48600)
@@ -1757,11 +1757,15 @@
                     try:
                         key, value = option.split('=', 1)
                     except:
-                        if i == 0: # add key name of first parameter if not given
-                            key = self.grass_task.get_options()['params'][0]['name']
-                            value = option
+                        params = self.grass_task.get_options()['params']
+                        if params:
+                            if i == 0: # add key name of first parameter if not given
+                                key = params[0]['name']
+                                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:



More information about the grass-commit mailing list