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

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 28 09:24:06 EDT 2009


Author: martinl
Date: 2009-03-28 09:24:06 -0400 (Sat, 28 Mar 2009)
New Revision: 36500

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
Log:
wxGUI: fix overlays


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2009-03-27 14:23:22 UTC (rev 36499)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/render.py	2009-03-28 13:24:06 UTC (rev 36500)
@@ -126,11 +126,11 @@
         #
         # prepare command for each layer
         #
-        layertypes = ['raster', 'rgb', 'his', 'shaded', 'rastarrow', 'rastnum',
+        layertypes = ('raster', 'rgb', 'his', 'shaded', 'rastarrow', 'rastnum',
                       'vector','thememap','themechart',
                       'grid', 'geodesic', 'rhumb', 'labels',
                       'command',
-                      'overlay']
+                      'overlay')
         
         if self.type not in layertypes:
             raise gcmd.GStdError(_("<%(name)s>: layer type <%(type)s> is not supported yet.") % \
@@ -1228,8 +1228,7 @@
 
         return self.overlays[-1]
 
-    def ChangeOverlay(self, id, type, command,
-                      l_active=True, l_hidden=False, l_opacity=1, l_render=False):
+    def ChangeOverlay(self, id, render=False, **kargs):
         """
         Change overlay properities
 
@@ -1246,20 +1245,27 @@
         """
         overlay = self.GetOverlay(id, list=False)
         if  overlay is None:
-            overlay = Overlay(id, type, command,
-                              l_active, l_hidden, l_opacity)
-        else:
-            overlay.id = id
-            overlay.name = type
-            overlay.cmdlist = command
-            overlay.active = l_active
-            overlay.hidden = l_hidden
-            overlay.opacity = l_opacity
+            overlay = Overlay(id, type = None, cmd = None)
+        
+        if kargs.has_key('type'):
+            overlay.SetName(kargs['type']) # type -> overlay
+        
+        if kargs.has_key('command'):
+            overlay.SetCmd(kargs['command'])
+        
+        if kargs.has_key('active'):
+            overlay.SetActive(kargs['active'])
 
-        if l_render and command != [] and not overlay.Render():
+        if kargs.has_key('hidden'):
+            overlay.SetHidden(kargs['hidden'])
+
+        if kargs.has_key('opacity'):
+            overlay.SetOpacity(kargs['opacity'])
+        
+        if render and command != [] and not overlay.Render():
             raise gcmd.GException(_("Unable render overlay <%s>") % 
                                   (name))
-
+        
         return overlay
 
     def GetOverlay(self, id, list=False):



More information about the grass-commit mailing list