[GRASS-SVN] r57919 - in grass/trunk/gui/wxpython: core gui_core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 3 03:56:28 PDT 2013


Author: martinl
Date: 2013-10-03 03:56:28 -0700 (Thu, 03 Oct 2013)
New Revision: 57919

Modified:
   grass/trunk/gui/wxpython/core/gconsole.py
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI: update map for [r|r3].colors modules


Modified: grass/trunk/gui/wxpython/core/gconsole.py
===================================================================
--- grass/trunk/gui/wxpython/core/gconsole.py	2013-10-03 08:25:39 UTC (rev 57918)
+++ grass/trunk/gui/wxpython/core/gconsole.py	2013-10-03 10:56:28 UTC (rev 57919)
@@ -604,7 +604,8 @@
     def OnCmdDone(self, event):
         """!Command done (or aborted)
 
-        Sends signal mapCreated if map is recognized in output parameters.
+        Sends signal mapCreated if map is recognized in output
+        parameters or for specific modules (as r.colors).
         """
         # Process results here
         try:
@@ -654,10 +655,13 @@
             task = None
             return
 
+        name = task.get_name()
         for p in task.get_options()['params']:
             prompt = p.get('prompt', '')
             if prompt in ('raster', 'vector', '3d-raster') and \
-                    p.get('age', 'old') == 'new' and \
+                    (p.get('age', 'old') == 'new' or 
+                     # TODO: do it better (?)
+                     name in ('r.colors', 'r3.colors', 'v.colors')) and \
                     p.get('value', None):
                 name = p.get('value')
                 if '@' not in name:

Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2013-10-03 08:25:39 UTC (rev 57918)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2013-10-03 10:56:28 UTC (rev 57919)
@@ -648,10 +648,16 @@
             wx.FutureCall(2000, self.Close)
 
     def OnMapCreated(self, name, ltype):
+        """!Map created or changed
+
+        @param name map name
+        @param ltype layer type (prompt value)
+        """
         if hasattr(self, "addbox") and self.addbox.IsChecked():
             add = True
         else:
             add = False
+        
         if self._giface:
             self._giface.mapCreated.emit(name=name, ltype=ltype, add=add)
     

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2013-10-03 08:25:39 UTC (rev 57918)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2013-10-03 10:56:28 UTC (rev 57919)
@@ -1750,11 +1750,17 @@
     def OnMapCreated(self, name, ltype, add=None):
         """!Decides wheter the map should be added to layer tree."""
         if add is None:
+            # add new map into layer if globally enabled
             if UserSettings.Get(group = 'cmd',
                                 key = 'addNewLayer', subkey = 'enabled'):
                 self.AddOrUpdateMap(name, ltype)
         elif add:
+            # add new map into layer tree
             self.AddOrUpdateMap(name, ltype)
+        else:
+            # update the map
+            display = self.GetMapDisplay()
+            display.GetWindow().UpdateMap(render = True)
 
     def AddOrUpdateMap(self, mapName, ltype):
         """!Add map layer or update"""

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2013-10-03 08:25:39 UTC (rev 57918)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2013-10-03 10:56:28 UTC (rev 57919)
@@ -678,8 +678,8 @@
             command = 'r3.colors'
         else:
             command = 'r.colors'
-        GUI(parent = self).ParseCommand([command,
-                                         'map=%s' % name])
+        GUI(parent = self, giface = self._giface).ParseCommand([command,
+                                                                'map=%s' % name])
 
     def OnVectorColorTable(self, event):
         """!Set color table for vector map"""



More information about the grass-commit mailing list