[GRASS-SVN] r46537 - in
grass/branches/releasebranch_6_4/gui/wxpython: . gui_modules scripts
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jun 3 05:21:44 EDT 2011
Author: martinl
Date: 2011-06-03 02:21:43 -0700 (Fri, 03 Jun 2011)
New Revision: 46537
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gmodeler.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbars.py
grass/branches/releasebranch_6_4/gui/wxpython/scripts/vkrige.py
grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
Log:
wxGUI: don't use static indeces for notebook tabs
(merge r46536 from devbr6)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gmodeler.py 2011-06-03 09:19:31 UTC (rev 46536)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/gmodeler.py 2011-06-03 09:21:43 UTC (rev 46537)
@@ -547,14 +547,9 @@
self.statusbar = self.CreateStatusBar(number = 1)
- if globalvar.hasAgw:
- self.notebook = FN.FlatNotebook(parent = self, id = wx.ID_ANY,
- agwStyle = FN.FNB_FANCY_TABS | FN.FNB_BOTTOM |
- FN.FNB_NO_NAV_BUTTONS | FN.FNB_NO_X_BUTTON)
- else:
- self.notebook = FN.FlatNotebook(parent = self, id = wx.ID_ANY,
- style = FN.FNB_FANCY_TABS | FN.FNB_BOTTOM |
- FN.FNB_NO_NAV_BUTTONS | FN.FNB_NO_X_BUTTON)
+ self.notebook = menuform.GNotebook(parent = self,
+ style = FN.FNB_FANCY_TABS | FN.FNB_BOTTOM |
+ FN.FNB_NO_NAV_BUTTONS | FN.FNB_NO_X_BUTTON)
self.canvas = ModelCanvas(self)
self.canvas.SetBackgroundColour(wx.WHITE)
@@ -566,13 +561,12 @@
self.itemPanel = ItemPanel(parent = self)
- self.goutput = goutput.GMConsole(parent = self, pageid = 3,
- notebook = self.notebook)
+ self.goutput = goutput.GMConsole(parent = self, notebook = self.notebook)
- self.notebook.AddPage(self.canvas, text=_('Model'))
- self.notebook.AddPage(self.itemPanel, text=_('Items'))
- self.notebook.AddPage(self.variablePanel, text=_('Variables'))
- self.notebook.AddPage(self.goutput, text=_('Command output'))
+ self.notebook.AddPage(page = self.canvas, text=_('Model'), name = 'model')
+ self.notebook.AddPage(page = self.itemPanel, text=_('Items'), name = 'items')
+ self.notebook.AddPage(page = self.variablePanel, text=_('Variables'), name = 'variables')
+ self.notebook.AddPage(page = self.goutput, text=_('Command output'), name = 'output')
wx.CallAfter(self.notebook.SetSelection, 0)
wx.CallAfter(self.ModelChanged, False)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py 2011-06-03 09:19:31 UTC (rev 46536)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/goutput.py 2011-06-03 09:21:43 UTC (rev 46537)
@@ -168,9 +168,9 @@
class GMConsole(wx.SplitterWindow):
"""!Create and manage output console for commands run by GUI.
"""
- def __init__(self, parent, id=wx.ID_ANY, margin=False, pageid=0,
+ def __init__(self, parent, id = wx.ID_ANY, margin = False,
notebook = None,
- style=wx.TAB_TRAVERSAL | wx.FULL_REPAINT_ON_RESIZE,
+ style = wx.TAB_TRAVERSAL | wx.FULL_REPAINT_ON_RESIZE,
**kwargs):
wx.SplitterWindow.__init__(self, parent, id, style = style, *kwargs)
self.SetName("GMConsole")
@@ -185,8 +185,7 @@
else:
self._notebook = self.parent.notebook
self.lineWidth = 80
- self.pageid = pageid
-
+
# remember position of line begining (used for '\r')
self.linePos = -1
@@ -383,8 +382,8 @@
self.cmd_output.SetStyle()
if switchPage and \
- self._notebook.GetSelection() != self.parent.goutput.pageid:
- self._notebook.SetSelection(self.parent.goutput.pageid)
+ self._notebook.GetSelection() != self._notebook.GetPageIndexByName('console'):
+ self._notebook.SetSelectionByName('console')
if not style:
style = self.cmd_output.StyleDefault
@@ -512,8 +511,8 @@
# other GRASS commands (r|v|g|...)
# switch to 'Command output' if required
if switchPage:
- if self._notebook.GetSelection() != self.parent.goutput.pageid:
- self._notebook.SetSelection(self.parent.goutput.pageid)
+ if self._notebook.GetSelection() != self._notebook.GetPageIndexByName('console'):
+ self._notebook.SetSelectionByName('console')
self.parent.SetFocus()
self.parent.Raise()
@@ -634,12 +633,12 @@
"""!Print command output"""
message = event.text
type = event.type
- if self._notebook.GetSelection() != self.parent.goutput.pageid:
- textP = self._notebook.GetPageText(self.parent.goutput.pageid)
+ if self._notebook.GetSelection() != self._notebook.GetPageIndexByName('console'):
+ page = self._notebook.GetPageIndexByName('console')
+ textP = self._notebook.GetPageText(page)
if textP[-1] != ')':
textP += ' (...)'
- self._notebook.SetPageText(self.parent.goutput.pageid,
- textP)
+ self._notebook.SetPageText(page, textP)
# message prefix
if type == 'warning':
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py 2011-06-03 09:19:31 UTC (rev 46536)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/layertree.py 2011-06-03 09:21:43 UTC (rev 46537)
@@ -630,7 +630,7 @@
@todo vector/volume
"""
- self.lmgr.SetNBPage('nviz')
+ self.lmgr.notebook.SetSelectionByName('nviz')
ltype = self.GetPyData(self.layer_selected)[0]['type']
if ltype == 'raster':
self.lmgr.nviz.SetPage('surface')
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py 2011-06-03 09:19:31 UTC (rev 46536)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/mapdisp.py 2011-06-03 09:21:43 UTC (rev 46537)
@@ -1219,7 +1219,7 @@
"""!Internal method used by OnQuery*() methods"""
if self.toolbars['map'].GetAction() == 'displayAttrb':
# switch to output console to show query results
- self._layerManager.SetNBPage('console')
+ self._layerManager.notebook.SetSelectionByName('console')
self.MapWindow.mouse['box'] = "point"
self.MapWindow.zoomtype = 0
@@ -1614,7 +1614,7 @@
self.totaldist = 0.0 # total measured distance
# switch Layer Manager to output console to show measure results
- self._layerManager.SetNBPage('console')
+ self._layerManager.notebook.SetSelectionByName('console')
# change mouse to draw line for measurement
self.MapWindow.mouse['use'] = "measure"
@@ -1655,8 +1655,9 @@
"""!Calculate map distance from screen distance
and print to output window
"""
- if self._layerManager.notebook.GetSelection() != self._layerManager.GetNBPageIndex('console'):
- self._layerManager.SetNBPage('console')
+ if self._layerManager.notebook.GetSelection() != \
+ self._layerManager.notebook.GetPageIndexByName('console'):
+ self._layerManager.notebook.SetSelectionByName('console')
dist, (north, east) = self.MapWindow.Distance(beginpt, endpt)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py 2011-06-03 09:19:31 UTC (rev 46536)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py 2011-06-03 09:21:43 UTC (rev 46537)
@@ -12,6 +12,7 @@
- GrassGUIApp
- GUI
- FloatValidator
+ - GNotebook
This program is just a coarse approach to automatically build a GUI
from a xml-based GRASS user interface description.
@@ -793,9 +794,9 @@
self.btn_help = wx.Button(parent = self.panel, id = wx.ID_HELP)
self.btn_help.SetToolTipString(_("Show manual page of the command (Ctrl+H)"))
self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp)
- if not hasattr(self.notebookpanel, "manual_tab_id"):
+ if self.notebookpanel.notebook.GetPageIndexByName('manual') < 0:
self.btn_help.Hide()
-
+
# add help button
btnsizer.Add(item = self.btn_help, proportion = 0, flag = wx.ALL | wx.ALIGN_CENTER, border = 10)
@@ -963,8 +964,8 @@
if self.standalone or 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)
+ if self.notebookpanel.notebook.GetSelection() != self.notebookpanel.notebook.GetPageIndexByName('output'):
+ self.notebookpanel.notebook.SetSelectionByName('output')
try:
@@ -1023,8 +1024,8 @@
def OnHelp(self, event):
"""!Show manual page (switch to the 'Manual' notebook page)"""
- if hasattr(self.notebookpanel, "manual_tab_id"):
- self.notebookpanel.notebook.SetSelection(self.notebookpanel.manual_tab_id)
+ if self.notebookpanel.notebook.GetPageIndexByName('manual') > -1:
+ self.notebookpanel.notebook.SetSelectionByName('manual')
self.notebookpanel.OnPageChange(None)
if event:
@@ -1081,11 +1082,7 @@
panelsizer = wx.BoxSizer(orient = wx.VERTICAL)
# Build notebook
- nbStyle = globalvar.FNPageStyle
- if globalvar.hasAgw:
- self.notebook = FN.FlatNotebook(self, id = wx.ID_ANY, agwStyle = nbStyle)
- else:
- self.notebook = FN.FlatNotebook(self, id = wx.ID_ANY, style = nbStyle)
+ self.notebook = GNotebook(self, style = globalvar.FNPageStyle)
self.notebook.SetTabAreaColour(globalvar.FNPageColor)
self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChange)
@@ -1095,25 +1092,21 @@
tab[section] = scrolled.ScrolledPanel(parent = self.notebook)
tab[section].SetScrollRate(10, 10)
tabsizer[section] = wx.BoxSizer(orient = wx.VERTICAL)
- self.notebook.AddPage(tab[section], text = section)
+ self.notebook.AddPage(page = tab[section], text = section)
# are we running from command line?
### add 'command output' tab regardless standalone dialog
if self.parent.GetName() == "MainFrame" and 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"))
+ self.goutput = goutput.GMConsole(parent = self, margin = False)
+ self.outpage = self.notebook.AddPage(page = self.goutput, text = _("Command output"), name = 'output')
else:
self.goutput = None
- self.goutputId = -1
self.manual_tab = HelpPanel(parent = self, grass_command = self.task.name)
if not self.manual_tab.IsFile():
self.manual_tab.Hide()
else:
- self.notebook.AddPage(self.manual_tab, text = _("Manual"))
- self.manual_tab_id = self.notebook.GetPageCount() - 1
+ self.notebook.AddPage(page = self.manual_tab, text = _("Manual"), name = 'manual')
self.notebook.SetSelection(0)
@@ -1806,9 +1799,9 @@
sel = self.notebook.GetSelection()
else:
sel = event.GetSelection()
-
- if hasattr(self, "manual_tab_id") and \
- sel == self.manual_tab_id:
+
+ idx = self.notebook.GetPageIndexByName('manual')
+ if idx > -1 and sel == idx:
# calling LoadPage() is strangely time-consuming (only first call)
# FIXME: move to helpPage.__init__()
if not self.manual_tab.IsLoaded():
@@ -2220,7 +2213,43 @@
def TransferFromWindow(self):
return True # Prevent wxDialog from complaining.
-
+
+class GNotebook(FN.FlatNotebook):
+ """!Generic notebook widget
+ """
+ def __init__(self, parent, style, **kwargs):
+ if globalvar.hasAgw:
+ FN.FlatNotebook.__init__(self, parent, id = wx.ID_ANY, agwStyle = style, **kwargs)
+ else:
+ FN.FlatNotebook.__init__(self, parent, id = wx.ID_ANY, style = style, **kwargs)
+
+ self.notebookPages = {}
+
+ def AddPage(self, **kwargs):
+ """!Add a page
+ """
+ if 'name' in kwargs:
+ self.notebookPages[kwargs['name']] = kwargs['page']
+ del kwargs['name']
+ super(GNotebook, self).AddPage(**kwargs)
+
+ def SetSelectionByName(self, page):
+ """!Set notebook
+
+ @param page names, eg. 'layers', 'console', 'search', 'pyshell', 'nviz'
+ """
+ self.SetSelection(self.GetPageIndexByName(page))
+
+ def GetPageIndexByName(self, page):
+ """!Get notebook page index
+
+ @param page name
+ """
+ if page not in self.notebookPages:
+ return -1
+
+ return self.GetPageIndex(self.notebookPages[page])
+
if __name__ == "__main__":
if len(sys.argv) == 1:
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py 2011-06-03 09:19:31 UTC (rev 46536)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py 2011-06-03 09:21:43 UTC (rev 46537)
@@ -112,6 +112,11 @@
'askOnQuit' : {
'enabled' : True
},
+ # hide tabs
+ 'hideTabs' : {
+ 'search' : False,
+ 'pyshell' : False,
+ },
},
#
# appearance
@@ -1107,7 +1112,27 @@
gridSizer.Add(item = askOnQuit,
pos = (row, 0), span = (1, 2))
+
+ row += 1
+ hideSearch = wx.CheckBox(parent = panel, id = wx.ID_ANY,
+ label = _("Hide '%s' tab (requires GUI restart)") % _("Search module"),
+ name = 'IsChecked')
+ hideSearch.SetValue(self.settings.Get(group = 'manager', key = 'hideTabs', subkey = 'search'))
+ self.winId['manager:hideTabs:search'] = hideSearch.GetId()
+ gridSizer.Add(item = hideSearch,
+ pos = (row, 0), span = (1, 2))
+
+ row += 1
+ hidePyShell = wx.CheckBox(parent = panel, id = wx.ID_ANY,
+ label = _("Hide '%s' tab (requires GUI restart)") % _("Python shell"),
+ name = 'IsChecked')
+ hidePyShell.SetValue(self.settings.Get(group = 'manager', key = 'hideTabs', subkey = 'pyshell'))
+ self.winId['manager:hideTabs:pyshell'] = hidePyShell.GetId()
+
+ gridSizer.Add(item = hidePyShell,
+ pos = (row, 0), span = (1, 2))
+
sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbars.py 2011-06-03 09:19:31 UTC (rev 46536)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbars.py 2011-06-03 09:21:43 UTC (rev 46537)
@@ -1218,7 +1218,7 @@
lmgr = self.parent.GetLayerManager()
if lmgr:
lmgr.toolbars['tools'].Enable('vdigit', enable = True)
- lmgr.SetNBPage('console')
+ lmgr.notebook.SetSelectionByName('console')
self.digit.CloseMap()
if lmgr:
lmgr.GetLogWindow().GetProgressBar().SetValue(0)
@@ -1410,7 +1410,7 @@
event.Skip()
return
- self.lmgr.SetNBPage('nviz')
+ self.lmgr.notebook.SetSelectionByName('nviz')
eId = event.GetId()
if eId == self.view:
self.lmgr.nviz.SetPage('view')
@@ -1453,7 +1453,7 @@
self.parent.MapWindow.polycoords = []
# return to map layer page (gets rid of ugly exit bug)
- self.lmgr.SetNBPage('layers')
+ self.lmgr.notebook.SetSelectionByName('layers')
# disable the toolbar
self.parent.RemoveToolbar("nviz")
Modified: grass/branches/releasebranch_6_4/gui/wxpython/scripts/vkrige.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/vkrige.py 2011-06-03 09:19:31 UTC (rev 46536)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/vkrige.py 2011-06-03 09:21:43 UTC (rev 46537)
@@ -103,7 +103,6 @@
## Command output. From menuform module, cmdPanel class
self.goutput = goutput.GMConsole(parent = self, margin = False,
- pageid = self.RPackagesBook.GetPageCount(),
notebook = self.RPackagesBook)
self.goutputId = self.RPackagesBook.GetPageCount()
self.outpage = self.RPackagesBook.AddPage(self.goutput, text = _("Command output"))
Modified: grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py 2011-06-03 09:19:31 UTC (rev 46536)
+++ grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py 2011-06-03 09:21:43 UTC (rev 46537)
@@ -126,11 +126,10 @@
# creating widgets
self._createMenuBar()
- self.statusbar = self.CreateStatusBar(number=1)
- self.notebookPages = {}
+ self.statusbar = self.CreateStatusBar(number = 1)
self.notebook = self._createNoteBook()
- self.toolbars = { 'main' : LayerManagerToolbar(parent = self),
- 'tools' : ToolsToolbar(parent = self) }
+ self.toolbars = { 'main' : LayerManagerToolbar(parent = self),
+ 'tools' : ToolsToolbar(parent = self) }
# self.SetToolBar(self.toolbar)
self._auimgr.AddPane(self.toolbars['main'],
@@ -164,7 +163,7 @@
self._auimgr.Update()
- wx.CallAfter(self.SetNBPage, 'layers')
+ wx.CallAfter(self.notebook.SetSelectionByName, 'layers')
# use default window layout ?
if UserSettings.Get(group = 'general', key = 'defWindowPos', subkey = 'enabled'):
@@ -218,10 +217,7 @@
def _createNoteBook(self):
"""!Creates notebook widgets"""
- if globalvar.hasAgw:
- self.notebook = FN.FlatNotebook(parent = self, id = wx.ID_ANY, agwStyle = globalvar.FNPageDStyle)
- else:
- self.notebook = FN.FlatNotebook(parent = self, id = wx.ID_ANY, style = globalvar.FNPageDStyle)
+ self.notebook = menuform.GNotebook(parent = self, style = globalvar.FNPageDStyle)
# create displays notebook widget and add it to main notebook page
cbStyle = globalvar.FNPageStyle
if globalvar.hasAgw:
@@ -229,23 +225,25 @@
else:
self.gm_cb = FN.FlatNotebook(self, id = wx.ID_ANY, style = cbStyle)
self.gm_cb.SetTabAreaColour(globalvar.FNPageColor)
- self.notebook.AddPage(self.gm_cb, text = _("Map layers"))
- self.notebookPages['layers'] = self.gm_cb
+ self.notebook.AddPage(page = self.gm_cb, text = _("Map layers"), name = 'layers')
# create 'command output' text area
- self.goutput = goutput.GMConsole(self, pageid = 1)
- self.notebook.AddPage(self.goutput, text = _("Command console"))
- self.notebookPages['console'] = self.goutput
+ self.goutput = goutput.GMConsole(self)
+ self.notebook.AddPage(page = self.goutput, text = _("Command console"), name = 'console')
# create 'search module' notebook page
- self.search = MenuTreeWindow(parent = self)
- self.notebook.AddPage(self.search, text = _("Search module"))
- self.notebookPages['search'] = self.search
+ if not UserSettings.Get(group = 'manager', key = 'hideTabs', subkey = 'search'):
+ self.search = MenuTreeWindow(parent = self)
+ self.notebook.AddPage(page = self.search, text = _("Search module"), name = 'search')
+ else:
+ self.search = None
# create 'python shell' notebook page
- self.pyshell = PyShellWindow(parent = self)
- self.notebook.AddPage(self.pyshell, text = _("Python shell"))
- self.notebookPages['pyshell'] = self.pyshell
+ if not UserSettings.Get(group = 'manager', key = 'hideTabs', subkey = 'pyshell'):
+ self.pyshell = PyShellWindow(parent = self)
+ self.notebook.AddPage(page = self.pyshell, text = _("Python shell"), name = 'pyshell')
+ else:
+ self.pyshell = None
# bindings
self.gm_cb.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnCBPageChanged)
@@ -253,29 +251,20 @@
self.gm_cb.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnCBPageClosed)
return self.notebook
-
- def SetNBPage(self, page):
- """!Set notebook page - 'layers', 'console', 'search', 'pyshell', 'nviz'"""
- self.notebook.SetSelection(self.GetNBPageIndex(page))
-
- def GetNBPageIndex(self, page):
- """!Get notebook page index"""
- return self.notebook.GetPageIndex(self.notebookPages[page])
-
+
def AddNviz(self):
"""!Add nviz notebook page"""
self.nviz = nviz_tools.NvizToolWindow(parent = self,
display = self.curr_page.maptree.GetMapDisplay())
- self.notebook.AddPage(self.nviz, text = _("3D view"))
- self.notebookPages['nviz'] = self.nviz
- self.SetNBPage('nviz')
+ self.notebook.AddPage(page = self.nviz, text = _("3D view"), name = 'nviz')
+ self.notebook.SetSelectionByName('nviz')
def RemoveNviz(self):
"""!Remove nviz notebook page"""
# print self.notebook.GetPage(1)
- self.notebook.RemovePage(self.GetNBPageIndex('nviz'))
+ self.notebook.RemovePage(self.notebook.GetPageIndexByName('nviz'))
del self.nviz
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
def WorkspaceChanged(self):
"""!Update window title"""
@@ -388,7 +377,7 @@
def OnPageChanged(self, event):
"""!Page in notebook changed"""
page = event.GetSelection()
- if page == self.goutput.pageid:
+ if page == self.notebook.GetPageIndexByName('console'):
# remove '(...)'
self.notebook.SetPageText(page, _("Command console"))
wx.CallAfter(self.goutput.cmd_prompt.SetFocus)
@@ -1315,7 +1304,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('raster')
def OnAddRaster3D(self, event):
@@ -1351,7 +1340,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('vector')
def OnAddVectorMisc(self, event):
@@ -1368,12 +1357,12 @@
def OnAddVectorTheme(self, event):
"""!Add thematic vector map to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('thememap')
def OnAddVectorChart(self, event):
"""!Add chart vector map to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('themechart')
def OnAddOverlay(self, event):
@@ -1394,32 +1383,32 @@
def OnAddRaster3D(self, event):
"""!Add 3D raster map to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('3d-raster')
def OnAddRasterRGB(self, event):
"""!Add RGB raster map to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('rgb')
def OnAddRasterHIS(self, event):
"""!Add HIS raster map to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('his')
def OnAddRasterShaded(self, event):
"""!Add shaded relief raster map to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('shaded')
def OnAddRasterArrow(self, event):
"""!Add flow arrows raster map to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('rastarrow')
def OnAddRasterNum(self, event):
"""!Add cell number raster map to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('rastnum')
def OnAddCommand(self, event):
@@ -1428,7 +1417,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('command')
# show map display
@@ -1440,7 +1429,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('group')
# show map display
@@ -1448,17 +1437,17 @@
def OnAddGrid(self, event):
"""!Add grid map layer to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('grid')
def OnAddGeodesic(self, event):
"""!Add geodesic line map layer to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('geodesic')
def OnAddRhumb(self, event):
"""!Add rhumb map layer to the current layer tree"""
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('rhumb')
def OnAddLabels(self, event):
@@ -1467,7 +1456,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
self.curr_page.maptree.AddLayer('labels')
# show map display
@@ -1520,10 +1509,10 @@
if event.ControlDown():
if kc == wx.WXK_TAB:
# switch layer list / command output
- if self.notebook.GetSelection() == self.GetNBPageIndex('layers'):
- self.SetNBPage('console')
+ if self.notebook.GetSelection() == self.notebook.GetPageIndexByName('layers'):
+ self.notebook.SetSelectionByName('console')
else:
- self.SetNBPage('layers')
+ self.notebook.SetSelectionByName('layers')
try:
ckc = chr(kc)
More information about the grass-commit
mailing list