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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 9 14:35:12 EDT 2010


Author: martinl
Date: 2010-10-09 18:35:12 +0000 (Sat, 09 Oct 2010)
New Revision: 43835

Modified:
   grass/trunk/gui/wxpython/gui_modules/gcmd.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
   grass/trunk/gui/wxpython/gui_modules/render.py
   grass/trunk/gui/wxpython/gui_modules/utils.py
Log:
wxGUI: various minor changes
(merge r43832 from devbr6)


Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py	2010-10-09 18:33:44 UTC (rev 43834)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py	2010-10-09 18:35:12 UTC (rev 43835)
@@ -564,7 +564,7 @@
         ps.stdin = None
     
     stdout, stderr = ps.communicate()
-
+    
     ret = ps.returncode
         
     if ret != 0 and parent: 

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py	2010-10-09 18:33:44 UTC (rev 43834)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py	2010-10-09 18:35:12 UTC (rev 43835)
@@ -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/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py	2010-10-09 18:33:44 UTC (rev 43834)
+++ grass/trunk/gui/wxpython/gui_modules/render.py	2010-10-09 18:35:12 UTC (rev 43835)
@@ -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
@@ -936,7 +936,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/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py	2010-10-09 18:33:44 UTC (rev 43834)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py	2010-10-09 18:35:12 UTC (rev 43835)
@@ -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)
@@ -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:
@@ -133,7 +136,7 @@
                 if p == 'layer':
                     continue
                 dcmd[i] = p + '=' + v + '@' + mapset
-    
+        
         maps = list()
         ogr = False
         for i, p, v in params:
@@ -142,6 +145,7 @@
             if p == 'layer' and not ogr:
                 continue
             maps.append(dcmd[i].split('=', 1)[1])
+        
         mapname = '\n'.join(maps)
     
     return mapname



More information about the grass-commit mailing list