瀏覽代碼

wxGUI: cosmetics in 'Command Output' tab, switch only if necessary
Cosmetics in Map Display positioning
(merge from devbr6, https://trac.osgeo.org/grass/changeset/33332)


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

Martin Landa 16 年之前
父節點
當前提交
2a70d136d7

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

@@ -390,8 +390,14 @@ class GMConsole(wx.Panel):
         type  = event.type
         type  = event.type
         
         
         # switch to 'Command output'
         # switch to 'Command output'
+        ### if self.parent.notebook.GetSelection() != self.parent.goutput.pageid:
+        ### self.parent.notebook.SetSelection(self.parent.goutput.pageid)
         if self.parent.notebook.GetSelection() != self.parent.goutput.pageid:
         if self.parent.notebook.GetSelection() != self.parent.goutput.pageid:
-            self.parent.notebook.SetSelection(self.parent.goutput.pageid)
+            textP = self.parent.notebook.GetPageText(self.parent.goutput.pageid)
+            if textP[-1] != ')':
+                textP += ' (...)'
+            self.parent.notebook.SetPageText(self.parent.goutput.pageid,
+                                             textP)
         
         
         # message prefix
         # message prefix
         if type == 'warning':
         if type == 'warning':

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

@@ -788,6 +788,10 @@ class mainFrame(wx.Frame):
         if cmd[0][0:2] != "d.":
         if cmd[0][0:2] != "d.":
             # Send any non-display command to parent window (probably wxgui.py)
             # Send any non-display command to parent window (probably wxgui.py)
             # put to parents
             # put to parents
+            # switch to 'Command output'
+            if self.notebookpanel.notebook.GetSelection() != self.notebookpanel.goutputId:
+                self.notebookpanel.notebook.SetSelection(self.notebookpanel.goutputId)
+            
             try:
             try:
                 self.goutput.RunCmd(cmd)
                 self.goutput.RunCmd(cmd)
             except AttributeError,e:
             except AttributeError,e:
@@ -915,10 +919,12 @@ class cmdPanel(wx.Panel):
         if self.parent.get_dcmd is None:
         if self.parent.get_dcmd is None:
             self.goutput = goutput.GMConsole(parent=self, margin=False,
             self.goutput = goutput.GMConsole(parent=self, margin=False,
                                              pageid=self.notebook.GetPageCount())
                                              pageid=self.notebook.GetPageCount())
+            self.goutputId = self.notebook.GetPageCount()
             self.outpage = self.notebook.AddPage(self.goutput, text=_("Command output") )
             self.outpage = self.notebook.AddPage(self.goutput, text=_("Command output") )
         else:
         else:
             self.goutput = None
             self.goutput = None
-
+            self.goutputId = -1
+            
         self.manual_tab = helpPanel(parent = self.notebook, grass_command = self.task.name)
         self.manual_tab = helpPanel(parent = self.notebook, grass_command = self.task.name)
         self.manual_tabsizer = wx.BoxSizer(wx.VERTICAL)
         self.manual_tabsizer = wx.BoxSizer(wx.VERTICAL)
         self.notebook.AddPage(self.manual_tab, text=_("Manual"))
         self.notebook.AddPage(self.manual_tab, text=_("Manual"))

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

@@ -95,8 +95,9 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
         self.reorder = False        # layer change requires a reordering
         self.reorder = False        # layer change requires a reordering
 
 
         # init associated map display
         # init associated map display
+        pos = wx.Point(self.disp_idx * 25, self.disp_idx * 25)
         self.mapdisplay = mapdisp.MapFrame(self,
         self.mapdisplay = mapdisp.MapFrame(self,
-                                           id=wx.ID_ANY, pos=wx.Point(50,50),
+                                           id=wx.ID_ANY, pos=pos,
                                            size=globalvar.MAP_WINDOW_SIZE,
                                            size=globalvar.MAP_WINDOW_SIZE,
                                            style=wx.DEFAULT_FRAME_STYLE,
                                            style=wx.DEFAULT_FRAME_STYLE,
                                            tree=self, notebook=self.notebook,
                                            tree=self, notebook=self.notebook,

+ 21 - 7
gui/wxpython/wxgui.py

@@ -310,8 +310,9 @@ class GMFrame(wx.Frame):
         self.outpage = self.notebook.AddPage(self.goutput, text=_("Command output"))
         self.outpage = self.notebook.AddPage(self.goutput, text=_("Command output"))
 
 
         # bingings
         # bingings
-        self.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.onCBPageChanged, self.gm_cb)
-        self.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.onCBPageClosed,  self.gm_cb)
+        self.gm_cb.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnCBPageChanged)
+        self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
+        self.gm_cb.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnCBPageClosed)
 
 
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer = wx.BoxSizer(wx.VERTICAL)
         sizer.Add(item=self.goutput, proportion=1,
         sizer.Add(item=self.goutput, proportion=1,
@@ -375,23 +376,32 @@ class GMFrame(wx.Frame):
         """
         """
         pass
         pass
 
 
-    # choicebook methods
-    def onCBPageChanged(self, event):
-        """Page in notebook changed"""
-
+    def OnCBPageChanged(self, event):
+        """Page in notebook (display) changed"""
         old_pgnum = event.GetOldSelection()
         old_pgnum = event.GetOldSelection()
         new_pgnum = event.GetSelection()
         new_pgnum = event.GetSelection()
+        
         self.curr_page   = self.gm_cb.GetCurrentPage()
         self.curr_page   = self.gm_cb.GetCurrentPage()
         self.curr_pagenum = self.gm_cb.GetSelection()
         self.curr_pagenum = self.gm_cb.GetSelection()
+        
         try:
         try:
             self.curr_page.maptree.mapdisplay.SetFocus()
             self.curr_page.maptree.mapdisplay.SetFocus()
             self.curr_page.maptree.mapdisplay.Raise()
             self.curr_page.maptree.mapdisplay.Raise()
         except:
         except:
             pass
             pass
+        
+        event.Skip()
 
 
+    def OnPageChanged(self, event):
+        """Page in notebook changed"""
+        page = event.GetSelection()
+        if page == self.goutput.pageid:
+            # remove '(...)'
+            self.notebook.SetPageText(page, _("Command output"))
+        
         event.Skip()
         event.Skip()
 
 
-    def onCBPageClosed(self, event):
+    def OnCBPageClosed(self, event):
         """
         """
         Page of notebook closed
         Page of notebook closed
         Also close associated map display
         Also close associated map display
@@ -406,6 +416,10 @@ class GMFrame(wx.Frame):
 
 
         cmd = event.GetString()
         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)
 
 
         self.OnUpdateStatusBar(None)
         self.OnUpdateStatusBar(None)