[GRASS-SVN] r53923 - in grass/trunk/gui/wxpython: gui_core lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 19 10:45:49 PST 2012
Author: annakrat
Date: 2012-11-19 10:45:48 -0800 (Mon, 19 Nov 2012)
New Revision: 53923
Modified:
grass/trunk/gui/wxpython/gui_core/widgets.py
grass/trunk/gui/wxpython/lmgr/frame.py
Log:
wxGUI: move highlighting of command tab from lmgr to notebook
Modified: grass/trunk/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/widgets.py 2012-11-19 18:11:23 UTC (rev 53922)
+++ grass/trunk/gui/wxpython/gui_core/widgets.py 2012-11-19 18:45:48 UTC (rev 53923)
@@ -72,9 +72,13 @@
self.notebookPages = {}
self.classObject = classObject
self.widget = widget
- # TODO: (...) should be only once in wxGUI
self.highlightedTextEnd = _(" (...)")
+ self.BindPageChanged()
+ def BindPageChanged(self):
+ """!Binds page changed event."""
+ self.widget.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnRemoveHighlight)
+
def AddPage(self, **kwargs):
"""!Add a new page
"""
@@ -131,13 +135,24 @@
idx = self.GetPageIndexByName(page)
if self.classObject.GetSelection(self.widget) != idx:
self.classObject.SetSelection(self.widget, idx)
- # FIXME: this code was not explicitly tested
- # FIXME: remove this from function lmgr.frame.Frame.OnPageChanged
- text = self.classObject.GetPageText(self.widget, idx)
- if text.endswith(self.highlightedTextEnd):
- text.replace(self.highlightedTextEnd, '')
- self.classObject.SetPageText(self.widget, idx, text)
+ self.RemoveHighlight(idx)
+
+ def OnRemoveHighlight(self, event):
+ """!Highlighted tab name should be removed."""
+ page = event.GetSelection()
+ self.RemoveHighlight(page)
+
+ def RemoveHighlight(self, page):
+ """!Removes highlight string from notebook tab name if necessary.
+
+ @param page index
+ """
+ text = self.classObject.GetPageText(self.widget, page)
+ if text.endswith(self.highlightedTextEnd):
+ text = text.replace(self.highlightedTextEnd, '')
+ self.classObject.SetPageText(self.widget, page, text)
+
def GetPageIndexByName(self, page):
"""!Get notebook page index
@@ -176,6 +191,9 @@
def __init__(self, classObject, widget):
NotebookController.__init__(self, classObject, widget)
+ def BindPageChanged(self):
+ self.widget.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnRemoveHighlight)
+
def GetPageIndexByName(self, page):
"""!Get notebook page index
Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py 2012-11-19 18:11:23 UTC (rev 53922)
+++ grass/trunk/gui/wxpython/lmgr/frame.py 2012-11-19 18:45:48 UTC (rev 53923)
@@ -477,8 +477,6 @@
"""!Page in notebook changed"""
page = event.GetSelection()
if page == self.notebook.GetPageIndexByName('output'):
- # remove '(...)'
- self.notebook.SetPageText(page, _("Command console"))
wx.CallAfter(self.goutput.ResetFocus)
self.SetStatusText('', 0)
More information about the grass-commit
mailing list