[GRASS-SVN] r53812 - in grass/branches/develbranch_6/gui/wxpython: core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 14 09:11:25 PST 2012


Author: martinl
Date: 2012-11-14 09:11:25 -0800 (Wed, 14 Nov 2012)
New Revision: 53812

Modified:
   grass/branches/develbranch_6/gui/wxpython/core/render.py
   grass/branches/develbranch_6/gui/wxpython/core/utils.py
   grass/branches/develbranch_6/gui/wxpython/lmgr/layertree.py
Log:
wxGUI bugfix: support unnamed paramaters in command map layers
      (merge r53811 from relbr64)


Modified: grass/branches/develbranch_6/gui/wxpython/core/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/render.py	2012-11-14 17:04:56 UTC (rev 53811)
+++ grass/branches/develbranch_6/gui/wxpython/core/render.py	2012-11-14 17:11:25 UTC (rev 53812)
@@ -176,10 +176,10 @@
                                       quiet = True,
                                       **self.cmd[1])
             
-            if msg:
+            if ret != 0:
                 sys.stderr.write(_("Command '%s' failed\n") % self.GetCmd(string = True))
-                sys.stderr.write(_("Details: %s\n") % msg)
-            if ret != 0:
+                if msg:
+                    sys.stderr.write(_("Details: %s\n") % msg)
                 raise GException()
         
         except GException:
@@ -309,7 +309,7 @@
             for c in cmd:
                 self.cmd.append(utils.CmdToTuple(c))
         else:
-            self.cmd  = utils.CmdToTuple(cmd)
+            self.cmd = utils.CmdToTuple(cmd)
         Debug.msg(3, "Layer.SetCmd(): cmd='%s'" % self.GetCmd(string = True))
         
         # for re-rendering

Modified: grass/branches/develbranch_6/gui/wxpython/core/utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/utils.py	2012-11-14 17:04:56 UTC (rev 53811)
+++ grass/branches/develbranch_6/gui/wxpython/core/utils.py	2012-11-14 17:11:25 UTC (rev 53812)
@@ -495,7 +495,7 @@
     """!Convert command list to tuple for gcmd.RunCommand()"""
     if len(cmd) < 1:
         return None
-        
+    
     dcmd = {}
     for item in cmd[1:]:
         if '=' in item: # params
@@ -505,13 +505,15 @@
             flag = item[2:]
             if flag in ('verbose', 'quiet', 'overwrite'):
                 dcmd[str(flag)] = True
-        else: # -> flags
+        elif len(item) == 2 and item[0] == '-': # -> flags
             if 'flags' not in dcmd:
                 dcmd['flags'] = ''
-            dcmd['flags'] += item.replace('-', '')
-                
-    return (cmd[0],
-            dcmd)
+            dcmd['flags'] += item[1]
+        else: # unnamed parameter
+            module = gtask.parse_interface(cmd[0])
+            dcmd[module.define_first()] = item
+    
+    return (cmd[0], dcmd)
 
 def PathJoin(*args):
     """!Check path created by os.path.join"""

Modified: grass/branches/develbranch_6/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/lmgr/layertree.py	2012-11-14 17:04:56 UTC (rev 53811)
+++ grass/branches/develbranch_6/gui/wxpython/lmgr/layertree.py	2012-11-14 17:11:25 UTC (rev 53812)
@@ -1192,14 +1192,13 @@
         ctrl = event.GetEventObject().GetId()
         cmd = event.GetString()
         
+        # find layer tree item by ctrl
         layer = self.GetFirstVisibleItem()
-
         while layer and layer.IsOk():
             if self.GetPyData(layer)[0]['ctrl'] == ctrl:
                 break
-            
             layer = self.GetNextVisible(layer)
-
+        
         # change parameters for item in layers list in render.Map
         self.ChangeLayer(layer)
         
@@ -1594,8 +1593,7 @@
             self.mapdisplay.GetToolbar('vdigit').UpdateListOfLayers(updateTool = True)
         
         # redraw map if auto-rendering is enabled
-        self.rerender = True
-        self.reorder = True
+        self.rerender = self.reorder = True
         
     def OnCloseWindow(self, event):
         pass



More information about the grass-commit mailing list