[GRASS-SVN] r43832 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 9 14:30:56 EDT 2010


Author: martinl
Date: 2010-10-09 18:30:56 +0000 (Sat, 09 Oct 2010)
New Revision: 43832

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py
Log:
wxGUI: various minor changes


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py	2010-10-09 18:29:56 UTC (rev 43831)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py	2010-10-09 18:30:56 UTC (rev 43832)
@@ -563,7 +563,7 @@
         ps.stdin = None
     
     stdout, stderr = ps.communicate()
-
+    
     ret = ps.returncode
         
     if ret != 0 and parent: 

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2010-10-09 18:29:56 UTC (rev 43831)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2010-10-09 18:30:56 UTC (rev 43832)
@@ -2732,8 +2732,7 @@
         
         
     def ZoomToMap(self, layers = None, ignoreNulls = False, render = True):
-        """!
-        Set display extents to match selected raster
+        """!Set display extents to match selected raster
         or vector map(s).
 
         @param layer list of layers to be zoom to
@@ -2754,7 +2753,7 @@
         for l in layers:
             # only raster/vector layers are currently supported
             if l.type == 'raster':
-                rast.append(l.name)
+                rast.append(l.GetName())
             elif l.type == 'vector':
                 digitToolbar = self.parent.toolbars['vdigit']
                 if digitToolbar and digitToolbar.GetLayer() == l:

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2010-10-09 18:29:56 UTC (rev 43831)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2010-10-09 18:30:56 UTC (rev 43832)
@@ -61,7 +61,7 @@
     """
     def __init__(self, type, cmd, name=None,
                  active=True, hidden=False, opacity=1.0):
-        """
+        """!
         @todo pass cmd as tuple instead of list
         
         @param type layer type ('raster', 'vector', 'overlay', 'command', etc.)
@@ -80,7 +80,7 @@
             for c in cmd:
                 self.cmd.append(utils.CmdToTuple(c))
         else:
-            self.cmd  = utils.CmdToTuple(cmd)
+            self.cmd = utils.CmdToTuple(cmd)
         
         self.active  = active
         self.hidden  = hidden
@@ -952,7 +952,6 @@
         # l_opacity must be <0;1>
         if l_opacity < 0: l_opacity = 0
         elif l_opacity > 1: l_opacity = 1
-        
         layer = MapLayer(type=type, name=name, cmd=command,
                          active=l_active, hidden=l_hidden, opacity=l_opacity)
         

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py	2010-10-09 18:29:56 UTC (rev 43831)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py	2010-10-09 18:30:56 UTC (rev 43832)
@@ -62,8 +62,8 @@
     except:
         return None
 
-def GetLayerNameFromCmd(dcmd, fullyQualified=False, param=None,
-                        layerType=None):
+def GetLayerNameFromCmd(dcmd, fullyQualified = False, param = None,
+                        layerType = None):
     """!Get map name from GRASS command
 
     @param dcmd GRASS command (given as list)
@@ -76,7 +76,7 @@
     @return '' if no map name found in command
     """
     mapname = ''
-
+    
     if len(dcmd) < 1:
         return mapname
     
@@ -87,7 +87,7 @@
     elif 'd.rhumbline' in dcmd[0]:
         mapname = 'rhumb'
     elif 'labels=' in dcmd[0]:
-        mapname = dcmd[idx].split('=')[1]+' labels'
+        mapname = dcmd[idx].split('=')[1] + ' labels'
     else:
         params = list()
         for idx in range(len(dcmd)):
@@ -107,8 +107,11 @@
                 params.append((idx, p, v))
         
         if len(params) < 1:
-            return mapname
-            
+            if len(dcmd) > 1 and '=' not in dcmd[1]:
+                params.append((1, None, dcmd[1]))
+            else:
+                return mapname
+        
         mapname = params[0][2]
         mapset = ''
         if fullyQualified and '@' not in mapname:
@@ -130,11 +133,17 @@
             
             # update dcmd
             for i, p, v in params:
-                dcmd[i] = p + '=' + v + '@' + mapset
-    
+                if p:
+                    dcmd[i] = p + '=' + v + '@' + mapset
+                else:
+                    dcmd[i] = v + '@' + mapset
+        
         maps = list()
         for i, p, v in params:
-            maps.append(dcmd[i].split('=', 1)[1])
+            if not p:
+                maps.append(v)
+            else:
+                maps.append(dcmd[i].split('=', 1)[1])
         mapname = '\n'.join(maps)
     
     return mapname



More information about the grass-commit mailing list