Browse Source

wxGUI:redraw display when r.colors is launched

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@43792 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 năm trước cách đây
mục cha
commit
ff2768e499

+ 1 - 1
gui/wxpython/gui_modules/gmodeler.py

@@ -991,7 +991,7 @@ class ModelFrame(wx.Frame):
         if params.has_key(name):
             item.SetParams(paramsOrig)
         
-    def OnDone(self, returncode):
+    def OnDone(self, cmd, returncode):
         """!Computation finished"""
         self.SetStatusText('', 0)
         

+ 3 - 2
gui/wxpython/gui_modules/goutput.py

@@ -128,7 +128,8 @@ class CmdThread(threading.Thread):
                     self.requestCmdColor = callable(*argsColor, **kwds)
                     self.resultQ.put((requestId, self.requestCmdColor.run()))
             
-            event = wxCmdDone(aborted = aborted,
+            event = wxCmdDone(cmd = args[0],
+                              aborted = aborted,
                               returncode = returncode,
                               time = requestTime,
                               pid = requestId,
@@ -697,7 +698,7 @@ class GMConsole(wx.SplitterWindow):
             self.btn_abort.Enable(False)
         
         if event.onDone:
-            event.onDone(returncode = event.returncode)
+            event.onDone(cmd = event.cmd, returncode = event.returncode)
         
         self.console_progressbar.SetValue(0) # reset progress bar on '0%'
 

+ 2 - 2
gui/wxpython/gui_modules/mapdisp.py

@@ -1337,9 +1337,9 @@ class MapFrame(wx.Frame):
             if vectstr:
                 gcmd.RunCommand(vcmd)
         
-    def _QueryMapDone(self, returncode):
+    def _QueryMapDone(self, cmd, returncode):
         """!Restore settings after querying (restore GRASS_REGION)
-
+        
         @param returncode command return code
         """
         if hasattr(self, "tmpreg"):

+ 16 - 1
gui/wxpython/gui_modules/menuform.py

@@ -876,6 +876,21 @@ class mainFrame(wx.Frame):
         
         event.Skip()
 
+    def OnDone(self, cmd, returncode):
+        """!This function is launched from OnRun() when command is
+        finished
+
+        @param returncode command's return code (0 for success)
+        """
+        if self.parent.GetName() != 'LayerTree' or \
+                returncode != 0:
+            return
+        
+        if cmd[0] in ('r.colors'):
+            display = self.parent.GetMapDisplay()
+            if display:
+                display.GetWindow().UpdateMap(render = True)
+        
     def OnOK(self, event):
         """!OK button pressed"""
         cmd = self.OnApply(event)
@@ -916,7 +931,7 @@ class mainFrame(wx.Frame):
             try:
                 if self.task.path:
                     cmd[0] = self.task.path # full path
-                self.goutput.RunCmd(cmd)
+                self.goutput.RunCmd(cmd, onDone = self.OnDone)
             except AttributeError, e:
                 print >> sys.stderr, "%s: Propably not running in wxgui.py session?" % (e)
                 print >> sys.stderr, "parent window is: %s" % (str(self.parent))