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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jul 26 15:37:29 EDT 2011


Author: martinl
Date: 2011-07-26 12:37:29 -0700 (Tue, 26 Jul 2011)
New Revision: 47251

Modified:
   grass/trunk/gui/wxpython/gui_modules/gcmd.py
   grass/trunk/gui/wxpython/gui_modules/goutput.py
   grass/trunk/gui/wxpython/gui_modules/layertree.py
   grass/trunk/gui/wxpython/gui_modules/render.py
   grass/trunk/gui/wxpython/gui_modules/utils.py
Log:
wxGUI: attempt to fix #1409


Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py	2011-07-26 17:52:23 UTC (rev 47250)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py	2011-07-26 19:37:29 UTC (rev 47251)
@@ -620,9 +620,6 @@
         else:
             GError(parent = parent,
                    message = stderr)
-
-    if ret != 0:
-        return None
     
     Debug.msg(3, "gcmd.RunCommand(): print read error")
     if not read:

Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2011-07-26 17:52:23 UTC (rev 47250)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2011-07-26 19:37:29 UTC (rev 47251)
@@ -471,7 +471,8 @@
             # send GRASS command without arguments to GUI command interface
             # except display commands (they are handled differently)
             if self.parent.GetName() == "LayerManager" and \
-                    command[0][0:2] == "d.":
+                    command[0][0:2] == "d." and \
+                    (len(command) > 1 and 'help' not in ' '.join(command[1:])):
                 # display GRASS commands
                 try:
                     layertype = {'d.rast'         : 'raster',
@@ -508,7 +509,7 @@
                         self.parent.curr_page.maptree.AddLayer(ltype = layertype,
                                                                lname = lname,
                                                                lcmd = command)
-                
+            
             else:
                 # other GRASS commands (r|v|g|...)
                 # switch to 'Command output' if required

Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-07-26 17:52:23 UTC (rev 47250)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py	2011-07-26 19:37:29 UTC (rev 47251)
@@ -845,7 +845,7 @@
                 
                 render = False
                 name = None
-
+            
             if ctrl:
                 ctrlId = ctrl.GetId()
             else:
@@ -1401,7 +1401,7 @@
         if not lname:
             dcmd    = self.GetPyData(item)[0]['cmd']
             lname, found = utils.GetLayerNameFromCmd(dcmd, layerType = mapLayer.GetType(),
-                                                       fullyQualified = True)
+                                                     fullyQualified = True)
             if not found:
                 return None
         

Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py	2011-07-26 17:52:23 UTC (rev 47250)
+++ grass/trunk/gui/wxpython/gui_modules/render.py	2011-07-26 19:37:29 UTC (rev 47251)
@@ -150,15 +150,14 @@
             else:
                 ret, msg = gcmd.RunCommand(self.cmd[0],
                                            getErrorMsg = True,
-                                           # quiet = True,
-                                           verbose = True,
+                                           quiet = True,
                                            **self.cmd[1])
-            
+                
             if ret != 0:
-                raise gcmd.GException(value = _("%s failed") % self.cmd[0])
+                raise gcmd.GException(value = _("'%s' failed. Details: %s") % (self.cmd[0], msg))
             
         except gcmd.GException, e:
-            # sys.stderr.write(e.value)
+            print >> sys.stderr, e.value
             # clean up after problems
             for f in [self.mapfile, self.maskfile]:
                 if not f:

Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py	2011-07-26 17:52:23 UTC (rev 47250)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py	2011-07-26 19:37:29 UTC (rev 47251)
@@ -24,6 +24,7 @@
 sys.path.append(os.path.join(globalvar.ETCDIR, "python"))
 
 from grass.script import core as grass
+from grass.script import task as gtask
 
 import gcmd
 from debug import Debug
@@ -75,6 +76,9 @@
                         layerType = None):
     """!Get map name from GRASS command
     
+    Parameter dcmd can be modified when first parameter is not
+    defined.
+    
     @param dcmd GRASS command (given as list)
     @param fullyQualified change map name to be fully qualified
     @param param params directory
@@ -116,7 +120,9 @@
         
         if len(params) < 1:
             if len(dcmd) > 1 and '=' not in dcmd[1]:
-                params.append((1, None, dcmd[1]))
+                task = gtask.parse_interface(dcmd[0])
+                p = task.get_options()['params'][0].get('name', '')
+                params.append((1, p, dcmd[1]))
             else:
                 return mapname, False
         



More information about the grass-commit mailing list