Browse Source

wxGUI/legend: avoid opening legend window when entering command from gui command line and fix after renaming parameters (merge from trunk, https://trac.osgeo.org/grass/changeset/63761)

git-svn-id: https://svn.osgeo.org/grass/grass/branches/releasebranch_7_0@63762 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 years ago
parent
commit
de8e42769c
2 changed files with 11 additions and 8 deletions
  1. 2 2
      gui/wxpython/mapdisp/frame.py
  2. 9 6
      gui/wxpython/mapwin/decorations.py

+ 2 - 2
gui/wxpython/mapdisp/frame.py

@@ -1172,14 +1172,14 @@ class MapFrame(SingleMapFrame):
                             continue
                         param, val = param_val
                         if param == 'raster':
-                            self.legend.cmd[idx] = 'rast={rast}'.format(rast=layer.maplayer.name)
+                            self.legend.cmd[idx] = 'raster={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('rast=%s' % layer.maplayer.name)
+                        self.legend.cmd.append('raster=%s' % layer.maplayer.name)
                     break
 
         if not showDialog and self.legend.CmdIsValid():

+ 9 - 6
gui/wxpython/mapwin/decorations.py

@@ -232,14 +232,17 @@ class LegendController(OverlayController):
 
     def CmdIsValid(self):
         inputs = 0
-        for param in self._cmd:
+        for param in self._cmd[1:]:
             param = param.split('=')
-            if param[0] == 'raster' and len(param) == 2:
-                inputs += 1
-            elif param[0] == 'raster_3d' and len(param) == 2:
+            if len(param) == 1:
                 inputs += 1
-            if inputs == 1:
-                return True
+            else:
+                if param[0] == 'raster' and len(param) == 2:
+                    inputs += 1
+                elif param[0] == 'raster_3d' and len(param) == 2:
+                    inputs += 1
+        if inputs == 1:
+            return True
         return False
 
     def ResizeLegend(self, begin, end, screenSize):