[GRASS-SVN] r43653 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Sep 23 16:44:29 EDT 2010


Author: martinl
Date: 2010-09-23 20:44:29 +0000 (Thu, 23 Sep 2010)
New Revision: 43653

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


Modified: grass/trunk/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gmodeler.py	2010-09-23 15:01:28 UTC (rev 43652)
+++ grass/trunk/gui/wxpython/gui_modules/gmodeler.py	2010-09-23 20:44:29 UTC (rev 43653)
@@ -2837,8 +2837,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/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-09-23 15:01:28 UTC (rev 43652)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-09-23 20:44:29 UTC (rev 43653)
@@ -2039,7 +2039,7 @@
         return processTask(tree).GetTask()
     
     def ParseCommand(self, cmd, gmpath = None, completed = None, parentframe = None,
-                     show = True, modal = False, centreOnParent = True):
+                     show = True, modal = False, centreOnParent = True, checkError = False):
         """!Parse command
         
         Note: cmd is given as list
@@ -2072,6 +2072,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
@@ -2092,8 +2093,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
                         try:
@@ -2137,7 +2143,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