[GRASS-SVN] r33334 - in grass/trunk/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Sep 8 12:47:11 EDT 2008


Author: martinl
Date: 2008-09-08 12:47:11 -0400 (Mon, 08 Sep 2008)
New Revision: 33334

Modified:
   grass/trunk/gui/wxpython/gui_modules/goutput.py
   grass/trunk/gui/wxpython/gui_modules/menuform.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: cosmetics in 'Command Output' tab, switch only if necessary
Cosmetics in Map Display positioning
(merge from devbr6, r33332)


Modified: grass/trunk/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-09-08 16:44:02 UTC (rev 33333)
+++ grass/trunk/gui/wxpython/gui_modules/goutput.py	2008-09-08 16:47:11 UTC (rev 33334)
@@ -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/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-09-08 16:44:02 UTC (rev 33333)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-09-08 16:47:11 UTC (rev 33334)
@@ -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/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-09-08 16:44:02 UTC (rev 33333)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-09-08 16:47:11 UTC (rev 33334)
@@ -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/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2008-09-08 16:44:02 UTC (rev 33333)
+++ grass/trunk/gui/wxpython/wxgui.py	2008-09-08 16:47:11 UTC (rev 33334)
@@ -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