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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Sep 23 16:48:43 EDT 2010


Author: martinl
Date: 2010-09-23 20:48:43 +0000 (Thu, 23 Sep 2010)
New Revision: 43654

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI/modeler: ignore missing parameters (show warning)
(merge r43653 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-09-23 20:44:29 UTC (rev 43653)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py	2010-09-23 20:48:43 UTC (rev 43654)
@@ -2843,8 +2843,10 @@
             cmd.append('%s=%s' % (name,
                                   self._filterValue(self._getNodeText(p, 'value'))))
         
-        task = menuform.GUI().ParseCommand(cmd = cmd,
-                                           show = None)
+        task, err = menuform.GUI().ParseCommand(cmd = cmd,
+                                                show = None, checkError = True)
+        if err:
+            GWarning(os.linesep.join(err))
         
         for opt, name in parameterized:
             if opt == 'flag':

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2010-09-23 20:44:29 UTC (rev 43653)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2010-09-23 20:48:43 UTC (rev 43654)
@@ -1875,7 +1875,7 @@
         return processTask(tree).GetTask()
     
     def ParseCommand(self, cmd, gmpath = None, completed = None, parentframe = None,
-                     show = True, modal = False):
+                     show = True, modal = False, centreOnParent = True, checkError = False):
         """!Parse command
         
         Note: cmd is given as list
@@ -1908,6 +1908,7 @@
             if 'flags' in dcmd_params:
                 self.grass_task.flags = dcmd_params['flags']
         
+        err = list()
         # update parameters if needed && validate command
         if len(cmd) > 1:
             i = 0
@@ -1928,8 +1929,13 @@
                             value = option
                         else:
                             raise ValueError, _("Unable to parse command %s") % ' '.join(cmd)
-
-                    element = self.grass_task.get_param(key)['element']
+                    
+                    element = self.grass_task.get_param(key, raiseError = False)
+                    if not element:
+                        err.append(_("%s: parameter '%s' not available") % (cmd[0], key))
+                        continue
+                    element = element['element']
+                    
                     if element in ['cell', 'vector']:
                         # mapname -> mapname at mapset
                         if '@' not in value:
@@ -1969,7 +1975,10 @@
         
         self.cmd = cmd
         
-        return self.grass_task
+        if checkError:
+            return self.grass_task, err
+        else:
+            return self.grass_task
     
     def GetCommandInputMapParamKey(self, cmd):
         """!Get parameter key for input raster/vector map



More information about the grass-commit mailing list