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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 1 07:26:23 EDT 2008


Author: martinl
Date: 2008-09-01 07:26:23 -0400 (Mon, 01 Sep 2008)
New Revision: 33189

Modified:
   grass/trunk/gui/wxpython/gui_modules/render.py
   grass/trunk/gui/wxpython/gui_modules/workspace.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: fix workspace (opacity and command layers)
(merge from devbr6, r33188)


Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py	2008-09-01 11:24:02 UTC (rev 33188)
+++ grass/trunk/gui/wxpython/gui_modules/render.py	2008-09-01 11:26:23 UTC (rev 33189)
@@ -194,7 +194,7 @@
                 cmdStr = ''
                 for cmd in self.cmdlist:
                     cmdStr += ' '.join(cmd) + ';'
-                return cmdStr
+                return cmdStr.rstrip(';')
             else:
                 return ' '.join(self.cmdlist)
         else:
@@ -1022,7 +1022,7 @@
         """
 
         Debug.msg (3, "Map.ChangeLayer(): layer=%s" % layer.name)
-
+        
         if kargs.has_key('type'):
             layer.SetType(kargs['type']) # check type
         

Modified: grass/trunk/gui/wxpython/gui_modules/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/workspace.py	2008-09-01 11:24:02 UTC (rev 33188)
+++ grass/trunk/gui/wxpython/gui_modules/workspace.py	2008-09-01 11:26:23 UTC (rev 33189)
@@ -235,7 +235,7 @@
                     "type"     : self.layerType,
                     "name"     : self.layerName,
                     "checked"  : int(self.layerChecked),
-                    "opacity"  : None,
+                    "opacity"  : 1.0,
                     "cmd"      : None,
                     "group"    : self.inTag['group'],
                     "display"  : self.displayIndex,
@@ -246,7 +246,7 @@
                 self.layers[-1]["opacity"] = float(self.layerOpacity)
             if self.cmd:
                 self.layers[-1]["cmd"] = self.cmd
-
+            
             self.layerType = self.layerName = self.Checked = \
                 self.Opacity = self.cmd = None
 
@@ -404,10 +404,10 @@
                 maplayer = None
 
             checked = int(item.IsChecked())
-            cmd = mapTree.GetPyData(item)[0]['cmd']
             if type == 'command':
+                cmd = mapTree.GetPyData(item)[0]['maplayer'].GetCmd(string=True)
                 self.file.write('%s<layer type="%s" name="%s" checked="%d">\n' % \
-                               (' ' * self.indent, type, ' '.join(cmd), checked));
+                               (' ' * self.indent, type, cmd, checked));
                 self.file.write('%s</layer>\n' % (' ' * self.indent));
             elif type == 'group':
                 name = mapTree.GetItemText(item)
@@ -419,6 +419,7 @@
                 self.indent -= 4
                 self.file.write('%s</group>\n' % (' ' * self.indent));
             else:
+                cmd = mapTree.GetPyData(item)[0]['maplayer'].GetCmd(string=False)
                 name = mapTree.GetItemText(item)
                 # remove 'opacity' part
                 if '(opacity' in name:

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-09-01 11:24:02 UTC (rev 33188)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-09-01 11:26:23 UTC (rev 33189)
@@ -649,17 +649,16 @@
         self.first = False
 
         if ltype != 'group':
-            if lopacity:
-                opacity = int(lopacity * 100)
-            else:
-                opacity = 100
-            
             if lcmd and len(lcmd) > 1:
                 cmd = lcmd
                 render = False
                 name = utils.GetLayerNameFromCmd(lcmd)
             else:
                 cmd = []
+                if ltype == 'command' and lname:
+                    for c in lname.split(';'):
+                        cmd.append(c.split(' '))
+                
                 render = False
                 name = None
 
@@ -695,7 +694,7 @@
             maplayer = self.Map.AddLayer(pos=pos,
                                          type=ltype, command=self.GetPyData(layer)[0]['cmd'], name=name,
                                          l_active=checked, l_hidden=False,
-                                         l_opacity=opacity, l_render=render)
+                                         l_opacity=lopacity, l_render=render)
             self.GetPyData(layer)[0]['maplayer'] = maplayer
 
             # run properties dialog if no properties given
@@ -718,13 +717,13 @@
         if lname:
             if ltype == 'group':
                 self.SetItemText(layer, lname)
-            elif ltype != 'command':
+            elif ltype == 'command':
+                ctrl.SetValue(lname)
+            else:
                 name = lname + ' (opacity: ' + \
                        str(self.GetPyData(layer)[0]['maplayer'].GetOpacity()) + '%)'
                 self.SetItemText(layer, name)
-            else:
-                ctrl.SetValue(lname)
-            
+                
         # updated progress bar range (mapwindow statusbar)
         if checked is True:
             self.mapdisplay.onRenderGauge.SetRange(len(self.Map.GetListOfLayers(l_active=True)))



More information about the grass-commit mailing list