[GRASS-SVN] r33332 - in grass/branches/develbranch_6/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 8 12:39:43 EDT 2008


Author: martinl
Date: 2008-09-08 12:39:42 -0400 (Mon, 08 Sep 2008)
New Revision: 33332

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py
   grass/branches/develbranch_6/gui/wxpython/wxgui.py
Log:
wxGUI: cosmetics in 'Command Output' tab, switch only if necessary
Cosmetics in Map Display positioning


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2008-09-08 15:25:04 UTC (rev 33331)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/goutput.py	2008-09-08 16:39:42 UTC (rev 33332)
@@ -390,8 +390,14 @@
         type  = event.type
         
         # 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:
-            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
         if type == 'warning':

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2008-09-08 15:25:04 UTC (rev 33331)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2008-09-08 16:39:42 UTC (rev 33332)
@@ -788,6 +788,10 @@
         if cmd[0][0:2] != "d.":
             # Send any non-display command to parent window (probably wxgui.py)
             # put to parents
+            # switch to 'Command output'
+            if self.notebookpanel.notebook.GetSelection() != self.notebookpanel.goutputId:
+                self.notebookpanel.notebook.SetSelection(self.notebookpanel.goutputId)
+            
             try:
                 self.goutput.RunCmd(cmd)
             except AttributeError,e:
@@ -915,10 +919,12 @@
         if self.parent.get_dcmd is None:
             self.goutput = goutput.GMConsole(parent=self, margin=False,
                                              pageid=self.notebook.GetPageCount())
+            self.goutputId = self.notebook.GetPageCount()
             self.outpage = self.notebook.AddPage(self.goutput, text=_("Command output") )
         else:
             self.goutput = None
-
+            self.goutputId = -1
+            
         self.manual_tab = helpPanel(parent = self.notebook, grass_command = self.task.name)
         self.manual_tabsizer = wx.BoxSizer(wx.VERTICAL)
         self.notebook.AddPage(self.manual_tab, text=_("Manual"))

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py	2008-09-08 15:25:04 UTC (rev 33331)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/wxgui_utils.py	2008-09-08 16:39:42 UTC (rev 33332)
@@ -95,8 +95,9 @@
         self.reorder = False        # layer change requires a reordering
 
         # init associated map display
+        pos = wx.Point(self.disp_idx * 25, self.disp_idx * 25)
         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,
                                            style=wx.DEFAULT_FRAME_STYLE,
                                            tree=self, notebook=self.notebook,

Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py	2008-09-08 15:25:04 UTC (rev 33331)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py	2008-09-08 16:39:42 UTC (rev 33332)
@@ -310,8 +310,9 @@
         self.outpage = self.notebook.AddPage(self.goutput, text=_("Command output"))
 
         # 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.Add(item=self.goutput, proportion=1,
@@ -375,23 +376,32 @@
         """
         pass
 
-    # choicebook methods
-    def onCBPageChanged(self, event):
-        """Page in notebook changed"""
-
+    def OnCBPageChanged(self, event):
+        """Page in notebook (display) changed"""
         old_pgnum = event.GetOldSelection()
         new_pgnum = event.GetSelection()
+        
         self.curr_page   = self.gm_cb.GetCurrentPage()
         self.curr_pagenum = self.gm_cb.GetSelection()
+        
         try:
             self.curr_page.maptree.mapdisplay.SetFocus()
             self.curr_page.maptree.mapdisplay.Raise()
         except:
             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()
 
-    def onCBPageClosed(self, event):
+    def OnCBPageClosed(self, event):
         """
         Page of notebook closed
         Also close associated map display
@@ -406,6 +416,10 @@
 
         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.OnUpdateStatusBar(None)



More information about the grass-commit mailing list