Browse Source

wxGUI/GConsole: fix 53921 (applying changes for forms and gmodeler)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53922 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 12 năm trước cách đây
mục cha
commit
85ee9c4970
2 tập tin đã thay đổi với 27 bổ sung6 xóa
  1. 14 4
      gui/wxpython/gmodeler/frame.py
  2. 13 2
      gui/wxpython/gui_core/forms.py

+ 14 - 4
gui/wxpython/gmodeler/frame.py

@@ -34,7 +34,7 @@ import wx.lib.flatnotebook    as FN
 
 from core                 import globalvar
 from gui_core.widgets     import GNotebook
-from gui_core.goutput     import GConsole
+from gui_core.goutput     import GConsole, EVT_OUTPUT_TEXT
 from core.debug           import Debug
 from core.gcmd            import GMessage, GException, GWarning, GError, RunCommand
 from gui_core.dialogs     import GetImageHandlers
@@ -104,7 +104,8 @@ class ModelFrame(wx.Frame):
         
         self.pythonPanel = PythonPanel(parent = self)
         
-        self.goutput = GConsole(parent = self, frame = self, notebook = self.notebook)
+        self.goutput = GConsole(parent = self, frame = self)
+        self.goutput.Bind(EVT_OUTPUT_TEXT, self.OnOutputText)
         
         self.notebook.AddPage(page = self.canvas, text=_('Model'), name = 'model')
         self.notebook.AddPage(page = self.itemPanel, text=_('Items'), name = 'items')
@@ -687,8 +688,17 @@ class ModelFrame(wx.Frame):
         self.model.AddItem(data)
         
         self.canvas.Refresh()
-        
-        
+
+    def OnOutputText(self, event):
+        """!Manages @c 'output' notebook page according to event priority."""
+        if event.priority == 1:
+            self.notebook.HighlightPageByName('output')
+        if event.priority >= 2:
+            self.notebook.SetSelectionByName('output')
+        if event.priority >= 3:
+            self.SetFocus()
+            self.Raise()
+
     def OnHelp(self, event):
         """!Display manual page"""
         grass.run_command('g.manual',

+ 13 - 2
gui/wxpython/gui_core/forms.py

@@ -1617,8 +1617,9 @@ class CmdPanel(wx.Panel):
         # are we running from command line?
         ### add 'command output' tab regardless standalone dialog
         if self.parent.GetName() == "MainFrame" and self.parent.get_dcmd is None:
-            from gui_core.goutput import GConsole
-            self.goutput = GConsole(parent = self.notebook, frame = self.parent, margin = False, notebook = self.notebook)
+            from gui_core.goutput import GConsole, EVT_OUTPUT_TEXT
+            self.goutput = GConsole(parent = self.notebook, frame = self.parent, margin = False)
+            self.goutput.Bind(EVT_OUTPUT_TEXT, self.OnOutputText)
             self.outpage = self.notebook.AddPage(page = self.goutput, text = _("Command output"), name = 'output')
             index = self.AddBitmapToImageList(section = 'output', imageList = imageList)
             if index >= 0:
@@ -1845,6 +1846,16 @@ class CmdPanel(wx.Panel):
             # event is somehow propagated?
             event.StopPropagation()
 
+    def OnOutputText(self, event):
+        """!Manages @c 'output' notebook page according to event priority."""
+        if event.priority == 1:
+            self.notebook.HighlightPageByName('output')
+        if event.priority >= 2:
+            self.notebook.SetSelectionByName('output')
+        if event.priority >= 3:
+            self.SetFocus()
+            self.Raise()
+
     def OnColorChange(self, event):
         myId = event.GetId()
         for p in self.task.params: