Przeglądaj źródła

wxGUI: switch to 'Command output' page on 'print metadata'
(merge from devbr6, https://trac.osgeo.org/grass/changeset/33748)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@33749 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 16 lat temu
rodzic
commit
fd09320dd6

+ 7 - 1
gui/wxpython/gui_modules/goutput.py

@@ -246,7 +246,7 @@ class GMConsole(wx.Panel):
         """Write out line in warning style"""
         self.WriteLog(line, style=self.cmd_output.StyleWarning)
 
-    def RunCmd(self, command, compReg=True):
+    def RunCmd(self, command, compReg=True, switchPage=False):
         """
         Run in GUI GRASS (or other) commands typed into
         console command text widget, and send stdout output to output
@@ -261,6 +261,7 @@ class GMConsole(wx.Panel):
 
         @param command command (list)
         @param compReg if true use computation region
+        @param switchPage switch to output page
         """
         
         # map display window available ?
@@ -311,6 +312,11 @@ class GMConsole(wx.Panel):
                 # other GRASS commands (r|v|g|...)
                 #
                 
+                # switch to 'Command output'
+                if switchPage and \
+                        self.parent.notebook.GetSelection() != self.parent.goutput.pageid:
+                    self.parent.notebook.SetSelection(self.parent.goutput.pageid)
+
                 # activate computational region (set with g.region)
                 # for all non-display commands.
                 if compReg:

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

@@ -363,7 +363,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
         cmd.append('map=%s' % mapLayer.name)
 
         # print output to command log area
-        self.gismgr.goutput.RunCmd(cmd)
+        self.gismgr.goutput.RunCmd(cmd, switchPage=True)
 
     def OnSetCompRegFromRaster(self, event):
         """Set computational region from selected raster map (ignore NULLs)"""

+ 2 - 6
gui/wxpython/wxgui.py

@@ -415,13 +415,9 @@ class GMFrame(wx.Frame):
         """Run command"""
 
         cmd = event.GetString()
-
-        # switch to 'Command output'
-        if self.notebook.GetSelection() != self.goutput.pageid:
-            self.notebook.SetSelection(self.goutput.pageid)
         
-        self.goutput.RunCmd(cmd)
-
+        self.goutput.RunCmd(cmd, switchPage=True)
+        
         self.OnUpdateStatusBar(None)
 
     def GetLogWindow(self):