ソースを参照

wxGUI/GConsole: various fixes related to https://trac.osgeo.org/grass/changeset/53921

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@53924 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 12 年 前
コミット
e1e37bc564
2 ファイル変更20 行追加7 行削除
  1. 8 5
      gui/wxpython/gui_core/goutput.py
  2. 12 2
      gui/wxpython/scripts/vkrige.py

+ 8 - 5
gui/wxpython/gui_core/goutput.py

@@ -448,23 +448,26 @@ class GConsole(wx.SplitterWindow):
                 sys.stderr = sys.__stderr__
         
     def WriteLog(self, text, style = None, wrap = None,
-                 switchPage = False):
+                 switchPage = False, priority = 1):
         """!Generic method for writing log message in 
         given style
 
         @param line text line
         @param style text style (see GStc)
         @param stdout write to stdout or stderr
+        @param switchPage for backward compatibility
+        (replace by priority: False=1, True=2)
+        @param priority priority of this message
+        (0=no priority, 1=normal, 2=medium, 3=high)
         """
 
         self.cmdOutput.SetStyle()
 
         # documenting old behavior/implementation:
         # switch notebook if required
-        if switchPage:
-            priority = 2
-        else:
-            priority = 1
+        if priority == 1:
+            if switchPage:
+                priority = 2
         event = gOutputText(priority = priority)
         wx.PostEvent(self, event)
         

+ 12 - 2
gui/wxpython/scripts/vkrige.py

@@ -98,10 +98,10 @@ class KrigingPanel(wx.Panel):
             self.CreatePage(package = Rpackage, Rinstance = Rinstance, controller = controller)
         
         ## Command output. From menuform module, cmdPanel class
-        self.goutput = goutput.GConsole(parent = self, frame = self.parent, margin = False,
-                                         notebook = self.RPackagesBook)
+        self.goutput = goutput.GConsole(parent = self, frame = self.parent, margin = False)
         self.goutputId = self.RPackagesBook.GetPageCount()
         self.outpage = self.RPackagesBook.AddPage(page = self.goutput, text = _("Command output"), name = 'output')
+        self.goutput.Bind(goutput.EVT_OUTPUT_TEXT, self.OnOutputText)
         
         self.RPackagesBook.SetSelection(0)
         KrigingSizer.Add(self.RPackagesBook, proportion = 1, flag = wx.EXPAND)
@@ -255,6 +255,16 @@ class KrigingPanel(wx.Panel):
     def OnVarianceCBChecked(self, event):
         self.OutputVarianceMapName.Enable(event.IsChecked())
 
+    def OnOutputText(self, event):
+        """!Manages @c 'output' notebook page according to event priority."""
+        if event.priority == 1:
+            self.RPackagesBook.HighlightPageByName('output')
+        if event.priority >= 2:
+            self.RPackagesBook.SetSelectionByName('output')
+        if event.priority >= 3:
+            self.SetFocus()
+            self.Raise()
+
 class KrigingModule(wx.Frame):
     """ Kriging module for GRASS GIS. Depends on R and its packages gstat and geoR. """
     def __init__(self, parent, Rinstance, controller, *args, **kwargs):