Forráskód Böngészése

wxGUI: update map for [r|r3].colors modules

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@57919 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 11 éve
szülő
commit
0deecaa203

+ 6 - 2
gui/wxpython/core/gconsole.py

@@ -604,7 +604,8 @@ class GConsole(wx.EvtHandler):
     def OnCmdDone(self, event):
     def OnCmdDone(self, event):
         """!Command done (or aborted)
         """!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
         # Process results here
         try:
         try:
@@ -654,10 +655,13 @@ class GConsole(wx.EvtHandler):
             task = None
             task = None
             return
             return
 
 
+        name = task.get_name()
         for p in task.get_options()['params']:
         for p in task.get_options()['params']:
             prompt = p.get('prompt', '')
             prompt = p.get('prompt', '')
             if prompt in ('raster', 'vector', '3d-raster') and \
             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):
                     p.get('value', None):
                 name = p.get('value')
                 name = p.get('value')
                 if '@' not in name:
                 if '@' not in name:

+ 6 - 0
gui/wxpython/gui_core/forms.py

@@ -648,10 +648,16 @@ class TaskFrame(wx.Frame):
             wx.FutureCall(2000, self.Close)
             wx.FutureCall(2000, self.Close)
 
 
     def OnMapCreated(self, name, ltype):
     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():
         if hasattr(self, "addbox") and self.addbox.IsChecked():
             add = True
             add = True
         else:
         else:
             add = False
             add = False
+        
         if self._giface:
         if self._giface:
             self._giface.mapCreated.emit(name=name, ltype=ltype, add=add)
             self._giface.mapCreated.emit(name=name, ltype=ltype, add=add)
     
     

+ 6 - 0
gui/wxpython/lmgr/frame.py

@@ -1750,11 +1750,17 @@ class GMFrame(wx.Frame):
     def OnMapCreated(self, name, ltype, add=None):
     def OnMapCreated(self, name, ltype, add=None):
         """!Decides wheter the map should be added to layer tree."""
         """!Decides wheter the map should be added to layer tree."""
         if add is None:
         if add is None:
+            # add new map into layer if globally enabled
             if UserSettings.Get(group = 'cmd',
             if UserSettings.Get(group = 'cmd',
                                 key = 'addNewLayer', subkey = 'enabled'):
                                 key = 'addNewLayer', subkey = 'enabled'):
                 self.AddOrUpdateMap(name, ltype)
                 self.AddOrUpdateMap(name, ltype)
         elif add:
         elif add:
+            # add new map into layer tree
             self.AddOrUpdateMap(name, ltype)
             self.AddOrUpdateMap(name, ltype)
+        else:
+            # update the map
+            display = self.GetMapDisplay()
+            display.GetWindow().UpdateMap(render = True)
 
 
     def AddOrUpdateMap(self, mapName, ltype):
     def AddOrUpdateMap(self, mapName, ltype):
         """!Add map layer or update"""
         """!Add map layer or update"""

+ 2 - 2
gui/wxpython/lmgr/layertree.py

@@ -678,8 +678,8 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             command = 'r3.colors'
             command = 'r3.colors'
         else:
         else:
             command = 'r.colors'
             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):
     def OnVectorColorTable(self, event):
         """!Set color table for vector map"""
         """!Set color table for vector map"""