[GRASS-SVN] r53924 - in grass/trunk/gui/wxpython: gui_core scripts

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Nov 19 13:16:48 PST 2012


Author: wenzeslaus
Date: 2012-11-19 13:16:48 -0800 (Mon, 19 Nov 2012)
New Revision: 53924

Modified:
   grass/trunk/gui/wxpython/gui_core/goutput.py
   grass/trunk/gui/wxpython/scripts/vkrige.py
Log:
wxGUI/GConsole: various fixes related to r53921

Modified: grass/trunk/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/goutput.py	2012-11-19 18:45:48 UTC (rev 53923)
+++ grass/trunk/gui/wxpython/gui_core/goutput.py	2012-11-19 21:16:48 UTC (rev 53924)
@@ -448,23 +448,26 @@
                 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)
         

Modified: grass/trunk/gui/wxpython/scripts/vkrige.py
===================================================================
--- grass/trunk/gui/wxpython/scripts/vkrige.py	2012-11-19 18:45:48 UTC (rev 53923)
+++ grass/trunk/gui/wxpython/scripts/vkrige.py	2012-11-19 21:16:48 UTC (rev 53924)
@@ -98,10 +98,10 @@
             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 @@
     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):



More information about the grass-commit mailing list