[GRASS-SVN] r60395 - in grass/branches/releasebranch_7_0: gui/wxpython/core gui/wxpython/mapdisp gui/wxpython/mapwin scripts/d.rast.leg

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 21 14:24:17 PDT 2014


Author: hamish
Date: 2014-05-21 14:24:17 -0700 (Wed, 21 May 2014)
New Revision: 60395

Modified:
   grass/branches/releasebranch_7_0/gui/wxpython/core/render.py
   grass/branches/releasebranch_7_0/gui/wxpython/mapdisp/frame.py
   grass/branches/releasebranch_7_0/gui/wxpython/mapwin/decorations.py
   grass/branches/releasebranch_7_0/scripts/d.rast.leg/d.rast.leg.py
Log:
reflect d.legend option changes (#2303), backport of r60103,4 from trunk

Modified: grass/branches/releasebranch_7_0/gui/wxpython/core/render.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/core/render.py	2014-05-21 17:46:17 UTC (rev 60394)
+++ grass/branches/releasebranch_7_0/gui/wxpython/core/render.py	2014-05-21 21:24:17 UTC (rev 60395)
@@ -358,7 +358,7 @@
         @param id overlay id (for PseudoDC)
         @param type overlay type ('barscale', 'legend', etc.)
         @param cmd GRASS command to render overlay,
-        given as list, e.g. ['d.legend', 'map=elevation at PERMANENT']
+        given as list, e.g. ['d.legend', 'rast=elevation at PERMANENT']
         @param Map render.Map instance
         @param active layer is active, will be rendered only if True
         @param hidden layer is hidden, won't be listed in Layer Manager if True

Modified: grass/branches/releasebranch_7_0/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/mapdisp/frame.py	2014-05-21 17:46:17 UTC (rev 60394)
+++ grass/branches/releasebranch_7_0/gui/wxpython/mapdisp/frame.py	2014-05-21 21:24:17 UTC (rev 60395)
@@ -1072,15 +1072,15 @@
                     for i, legendParam in enumerate(self.legend.cmd[1:]):
                         idx = i + 1
                         param, val = legendParam.split('=')
-                        if param == 'map':
-                            self.legend.cmd[idx] = 'map={rast}'.format(rast=layer.maplayer.name)
+                        if param == 'rast':
+                            self.legend.cmd[idx] = 'rast={rast}'.format(rast=layer.maplayer.name)
                             isMap = True
                         elif param in ('use', 'range'):
                             # clear range or use to avoid problems
                             del self.legend.cmd[idx]
 
                     if not isMap:  # for the first time
-                        self.legend.cmd.append('map=%s' % layer.maplayer.name)
+                        self.legend.cmd.append('rast=%s' % layer.maplayer.name)
                     break
 
         if not showDialog and self.legend.CmdIsValid():

Modified: grass/branches/releasebranch_7_0/gui/wxpython/mapwin/decorations.py
===================================================================
--- grass/branches/releasebranch_7_0/gui/wxpython/mapwin/decorations.py	2014-05-21 17:46:17 UTC (rev 60394)
+++ grass/branches/releasebranch_7_0/gui/wxpython/mapwin/decorations.py	2014-05-21 21:24:17 UTC (rev 60395)
@@ -229,9 +229,14 @@
             return x, y
 
     def CmdIsValid(self):
+        inputs = 0
         for param in self._cmd:
             param = param.split('=')
-            if param[0] == 'map' and len(param) == 2:
+            if param[0] == 'rast' and len(param) == 2:
+                inputs += 1
+            elif param[0] == 'rast3d' and len(param) == 2:
+                inputs += 1
+            if inputs == 1:
                 return True
         return False
 

Modified: grass/branches/releasebranch_7_0/scripts/d.rast.leg/d.rast.leg.py
===================================================================
--- grass/branches/releasebranch_7_0/scripts/d.rast.leg/d.rast.leg.py	2014-05-21 17:46:17 UTC (rev 60394)
+++ grass/branches/releasebranch_7_0/scripts/d.rast.leg/d.rast.leg.py	2014-05-21 21:24:17 UTC (rev 60395)
@@ -162,12 +162,14 @@
 #        lflags += 'n'
 
     make_frame(f, 0, 90, 70, 100)
-    grass.run_command('d.legend', flags = lflags, map = lmap, lines = nlines, at = leg_at)
+    grass.run_command('d.legend', flags = lflags, rast = lmap, lines = nlines, at = leg_at)
 
     #draw map
     make_frame(f, 0, 100, 0, 70)
     grass.run_command('d.rast', map = map)
 
+
 if __name__ == "__main__":
     options, flags = grass.parser()
     main()
+



More information about the grass-commit mailing list