[GRASS-SVN] r47256 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 27 05:25:47 EDT 2011


Author: martinl
Date: 2011-07-27 02:25:47 -0700 (Wed, 27 Jul 2011)
New Revision: 47256

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/render.py
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py
Log:
wxGUI: attempt to fix #1409
    (merge r47251 from trunk)


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2011-07-27 07:45:20 UTC (rev 47255)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py	2011-07-27 09:25:47 UTC (rev 47256)
@@ -470,7 +470,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',
@@ -507,7 +508,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/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py	2011-07-27 07:45:20 UTC (rev 47255)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py	2011-07-27 09:25:47 UTC (rev 47256)
@@ -807,7 +807,7 @@
                 
                 render = False
                 name = None
-
+            
             if ctrl:
                 ctrlId = ctrl.GetId()
             else:
@@ -1348,7 +1348,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/branches/releasebranch_6_4/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/render.py	2011-07-27 07:45:20 UTC (rev 47255)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/render.py	2011-07-27 09:25:47 UTC (rev 47256)
@@ -184,23 +184,11 @@
                                            quiet = True,
                                            **self.cmd[1])
             
-            # if len(msg):
-            # sys.stderr.write(_("Running") + " '" + utils.GetCmdString(self.cmd) + "'")
-            # sys.stderr.write(msg)
-            
             if ret != 0:
-                # clean up after problem
-                try:
-                    os.remove(self.mapfile)
-                    os.remove(self.maskfile)
-                    os.remove(self.gtemp)
-                except (OSError, TypeError):
-                    pass
-                self.mapfile = None
-                self.maskfile = None
+                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
             try:
                 os.remove(self.mapfile)

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py	2011-07-27 07:45:20 UTC (rev 47255)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/utils.py	2011-07-27 09:25:47 UTC (rev 47256)
@@ -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