فهرست منبع

wxGUI: attempt to fix https://trac.osgeo.org/grass/ticket/1409

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47251 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 سال پیش
والد
کامیت
72a14e7585

+ 0 - 3
gui/wxpython/gui_modules/gcmd.py

@@ -620,9 +620,6 @@ def RunCommand(prog, flags = "", overwrite = False, quiet = False, verbose = Fal
         else:
             GError(parent = parent,
                    message = stderr)
-
-    if ret != 0:
-        return None
     
     Debug.msg(3, "gcmd.RunCommand(): print read error")
     if not read:

+ 3 - 2
gui/wxpython/gui_modules/goutput.py

@@ -471,7 +471,8 @@ class GMConsole(wx.SplitterWindow):
             # 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 @@ class GMConsole(wx.SplitterWindow):
                         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

+ 2 - 2
gui/wxpython/gui_modules/layertree.py

@@ -845,7 +845,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
                 
                 render = False
                 name = None
-
+            
             if ctrl:
                 ctrlId = ctrl.GetId()
             else:
@@ -1401,7 +1401,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
         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
         

+ 4 - 5
gui/wxpython/gui_modules/render.py

@@ -150,15 +150,14 @@ class Layer(object):
             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:

+ 7 - 1
gui/wxpython/gui_modules/utils.py

@@ -24,6 +24,7 @@ import globalvar
 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 @@ def GetLayerNameFromCmd(dcmd, fullyQualified = False, param = None,
                         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 @@ def GetLayerNameFromCmd(dcmd, fullyQualified = False, param = None,
         
         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