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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 29 03:10:14 EDT 2008


Author: martinl
Date: 2008-08-29 03:10:14 -0400 (Fri, 29 Aug 2008)
New Revision: 33148

Modified:
   grass/trunk/gui/wxpython/gui_modules/render.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
Log:
wxGUI: fix trac #268 - the "command layer" in wxGUI does not work
(merge from devbr6, r33147)


Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py	2008-08-29 07:06:44 UTC (rev 33147)
+++ grass/trunk/gui/wxpython/gui_modules/render.py	2008-08-29 07:10:14 UTC (rev 33148)
@@ -75,8 +75,6 @@
         self.active  = active
         self.hidden  = hidden
         self.opacity = opacity
-
-        self._region = None # produced by `d.vect -r`
         
         self.force_render = True
         
@@ -103,19 +101,16 @@
         @return rendered image filename
         @return None on error
         """
-        self._region = None # reset region
-
         if len(self.cmdlist) == 0:
             return None
         
         # ignore in 2D
         if self.type == '3d-raster':
             return None
-
+        
         Debug.msg (3, "Layer.Render(): type=%s, name=%s" % \
                        (self.type, self.name))
-
-
+        
         #
         # prepare command for each layer
         #
@@ -124,7 +119,7 @@
                       'grid', 'geodesic', 'rhumb', 'labels',
                       'command',
                       'overlay']
-
+        
         if self.type not in layertypes:
             raise gcmd.GStdError(_("<%(name)s>: layer type <%(type)s> is not supported yet.") % \
                                      {'type' : self.type, 'name' : self.name})
@@ -141,7 +136,7 @@
         try:
             runcmd = gcmd.Command(cmd=self.cmdlist + ['--q'],
                                   stderr=None)
-
+            
             if runcmd.returncode != 0:
                 #clean up after probley
                 try:
@@ -152,7 +147,7 @@
                     pass
                 self.mapfile = None
                 self.maskfile = None
-
+        
         except gcmd.CmdError, e:
             print >> sys.stderr, e
             # clean up after problems
@@ -164,16 +159,16 @@
                 pass
             self.mapfile = None
             self.maskfile = None
-
+        
         #
         # stop monitor
         #
 	os.unsetenv("GRASS_PNGFILE")
-
+        
         self.force_render = False
         
         return self.mapfile
-
+    
     def GetCmd(self, string=False):
         """
         Get GRASS command as list of string.
@@ -263,11 +258,7 @@
 
         # for re-rendering
         self.force_render = True
-
-    def GetRegion(self):
-        """Get layer region or None"""
-        return self._region
-    
+        
 class MapLayer(Layer):
     """Represents map layer in the map canvas"""
     def __init__(self, type, cmd, name=None,

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-08-29 07:06:44 UTC (rev 33147)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-08-29 07:10:14 UTC (rev 33148)
@@ -949,8 +949,7 @@
         """Change command string"""
         ctrl = event.GetEventObject().GetId()
         cmd = event.GetString()
-        layer = None
-
+        
         layer = self.GetFirstVisibleItem()
 
         while layer and layer.IsOk():
@@ -960,15 +959,8 @@
             layer = self.GetNextVisible(layer)
 
         # change parameters for item in layers list in render.Map
-        if layer == False:
-            self.ChangeLayer(layer)
-            self.GetPyData(layer)[0]['cmd'] = cmd.split(' ')
-            maplayer = self.GetPyData(layer)[0]['maplayer']
-            for option in maplayer.GetCmd():
-                if 'map=' in option:
-                    mapname = option.split('=')[1]
-                    self.Map.ChangeLayerName(maplayer, mapname)
-
+        self.ChangeLayer(layer)
+        
         event.Skip()
 
     def OnChangeSel(self, event):



More information about the grass-commit mailing list