[GRASS-SVN] r48598 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Oct 2 17:16:33 EDT 2011


Author: martinl
Date: 2011-10-02 14:16:33 -0700 (Sun, 02 Oct 2011)
New Revision: 48598

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: fix running `d.* --help`
       add d.redraw to supported commands


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2011-10-02 20:27:25 UTC (rev 48597)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2011-10-02 21:16:33 UTC (rev 48598)
@@ -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/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2011-10-02 20:27:25 UTC (rev 48597)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2011-10-02 21:16:33 UTC (rev 48598)
@@ -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