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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 28 15:20:31 EDT 2010


Author: martinl
Date: 2010-10-28 12:20:31 -0700 (Thu, 28 Oct 2010)
New Revision: 44075

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
Log:
wxGUI: fix auto-rendering (cmdAutoRender)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py	2010-10-28 17:14:13 UTC (rev 44074)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/globalvar.py	2010-10-28 19:20:31 UTC (rev 44075)
@@ -180,6 +180,3 @@
 
 """@Check version of wxPython, use agwStyle for 2.8.11+"""
 hasAgw = CheckWxVersion()
-
-"""@List of commands for auto-rendering"""
-cmdAutoRender = [ 'r.colors', 'i.landsat.rgb' ]

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-10-28 17:14:13 UTC (rev 44074)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2010-10-28 19:20:31 UTC (rev 44075)
@@ -710,11 +710,23 @@
         # set focus on prompt
         if self.parent.GetName() == "LayerManager":
             self.btn_abort.Enable(False)
-            if event.cmd[0] in globalvar.cmdAutoRender:
-                display = self.parent.GetLayerTree().GetMapDisplay()
-                if display and display.IsAutoRendered():
-                    display.GetWindow().UpdateMap(render = True)
-        
+            display = self.parent.GetLayerTree().GetMapDisplay()
+            if display and display.IsAutoRendered():
+                mapLayers = map(lambda x: x.GetName(),
+                                display.GetRender().GetListOfLayers(l_type = 'raster') +
+                                display.GetRender().GetListOfLayers(l_type = 'vector'))
+                
+                task = menuform.GUI().ParseCommand(event.cmd, show = None)
+                for p in task.get_options()['params']:
+                    if p.get('prompt', '') not in ('raster', 'vector'):
+                        continue
+                    mapName = p.get('value', '')
+                    if '@' not in mapName:
+                        mapName = mapName + '@' + grass.gisenv()['MAPSET']
+                    if mapName in mapLayers:
+                        display.GetWindow().UpdateMap(render = True)
+                        return
+            
         else:
             # updated command dialog
             dialog = self.parent.parent

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2010-10-28 17:14:13 UTC (rev 44074)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2010-10-28 19:20:31 UTC (rev 44075)
@@ -850,18 +850,33 @@
 
         @param returncode command's return code (0 for success)
         """
-        if self.parent and self.parent.GetName() not in ('LayerTree', 'LayerManager') or \
-                returncode != 0:
+        if not self.parent or returncode != 0:
             return
+        if self.parent.GetName() not in ('LayerTree', 'LayerManager'):
+            return
         
-        if cmd[0] in globalvar.cmdAutoRender:
-            if self.parent.GetName() == 'LayerTree':
-                display = self.parent.GetMapDisplay()
-            else: # Layer Manager
-                display = self.parent.GetLayerTree().GetMapDisplay()
+        if self.parent.GetName() == 'LayerTree':
+            display = self.parent.GetMapDisplay()
+        else: # Layer Manager
+            display = self.parent.GetLayerTree().GetMapDisplay()
             
-            if display and display.IsAutoRendered():
+        if not display or not display.IsAutoRendered():
+            return
+        
+        mapLayers = map(lambda x: x.GetName(),
+                        display.GetRender().GetListOfLayers(l_type = 'raster') +
+                        display.GetRender().GetListOfLayers(l_type = 'vector'))
+        
+        task = GUI().ParseCommand(cmd, show = None)
+        for p in task.get_options()['params']:
+            if p.get('prompt', '') not in ('raster', 'vector'):
+                continue
+            mapName = p.get('value', '')
+            if '@' not in mapName:
+                mapName = mapName + '@' + grass.gisenv()['MAPSET']
+            if mapName in mapLayers:
                 display.GetWindow().UpdateMap(render = True)
+                return
         
     def OnOK(self, event):
         """!OK button pressed"""

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2010-10-28 17:14:13 UTC (rev 44074)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2010-10-28 19:20:31 UTC (rev 44075)
@@ -254,8 +254,11 @@
     def GetName(self, fullyQualified = True):
         """!Get map layer name
 
-        @param fullyQualified if True return 'name at mapset' otherwise
-        ('name', 'mapset')
+        @param fullyQualified True to return fully qualified name as a
+        string 'name at mapset' otherwise directory { 'name', 'mapset' }
+        is returned
+
+        @return string / directory
         """
         if fullyQualified:
             return self.name



More information about the grass-commit mailing list