[GRASS-SVN] r46515 - in grass/branches/develbranch_6/gui/wxpython:
. gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 2 09:06:03 EDT 2011
Author: martinl
Date: 2011-06-02 06:06:03 -0700 (Thu, 02 Jun 2011)
New Revision: 46515
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
grass/branches/develbranch_6/gui/wxpython/wxgui.py
Log:
annakrat: wxGUI: selection of tabs in Layer Manager's notebook changed
(merge r46514 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2011-06-02 12:09:51 UTC (rev 46514)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py 2011-06-02 13:06:03 UTC (rev 46515)
@@ -336,7 +336,7 @@
for elem in elem_list:
if elem != '':
fullqElem = elem + '@' + mapset
- if elements:
+ if elements is not None:
if (exclude and fullqElem in elements) or \
(not exclude and fullqElem not in elements):
continue
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py 2011-06-02 12:09:51 UTC (rev 46514)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/layertree.py 2011-06-02 13:06:03 UTC (rev 46515)
@@ -630,7 +630,7 @@
@todo vector/volume
"""
- self.lmgr.notebook.SetSelection(3)
+ self.lmgr.SetNBPage('nviz')
ltype = self.GetPyData(self.layer_selected)[0]['type']
if ltype == 'raster':
self.lmgr.nviz.SetPage('surface')
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2011-06-02 12:09:51 UTC (rev 46514)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2011-06-02 13:06:03 UTC (rev 46515)
@@ -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.notebook.SetSelection(1)
+ self._layerManager.SetNBPage('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.notebook.SetSelection(1)
+ self._layerManager.SetNBPage('console')
# change mouse to draw line for measurement
self.MapWindow.mouse['use'] = "measure"
@@ -1655,8 +1655,8 @@
"""!Calculate map distance from screen distance
and print to output window
"""
- if self._layerManager.notebook.GetSelection() != 1:
- self._layerManager.notebook.SetSelection(1)
+ if self._layerManager.notebook.GetSelection() != self._layerManager.GetNBPageIndex('console'):
+ self._layerManager.SetNBPage('console')
dist, (north, east) = self.MapWindow.Distance(beginpt, endpt)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py 2011-06-02 12:09:51 UTC (rev 46514)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/toolbars.py 2011-06-02 13:06:03 UTC (rev 46515)
@@ -1218,7 +1218,7 @@
lmgr = self.parent.GetLayerManager()
if lmgr:
lmgr.toolbars['tools'].Enable('vdigit', enable = True)
- lmgr.notebook.SetSelection(1)
+ lmgr.SetNBPage('console')
self.digit.CloseMap()
if lmgr:
lmgr.GetLogWindow().GetProgressBar().SetValue(0)
@@ -1410,7 +1410,7 @@
event.Skip()
return
- self.lmgr.notebook.SetSelection(3)
+ self.lmgr.SetNBPage('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.notebook.SetSelection(0)
+ self.lmgr.SetNBPage('layers')
# disable the toolbar
self.parent.RemoveToolbar("nviz")
Modified: grass/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py 2011-06-02 12:09:51 UTC (rev 46514)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py 2011-06-02 13:06:03 UTC (rev 46515)
@@ -127,6 +127,7 @@
# creating widgets
self._createMenuBar()
self.statusbar = self.CreateStatusBar(number=1)
+ self.notebookPages = {}
self.notebook = self._createNoteBook()
self.toolbars = { 'main' : LayerManagerToolbar(parent = self),
'tools' : ToolsToolbar(parent = self) }
@@ -163,7 +164,7 @@
self._auimgr.Update()
- wx.CallAfter(self.notebook.SetSelection, 0)
+ wx.CallAfter(self.SetNBPage, 'layers')
# use default window layout ?
if UserSettings.Get(group = 'general', key = 'defWindowPos', subkey = 'enabled'):
@@ -221,7 +222,6 @@
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)
-
# create displays notebook widget and add it to main notebook page
cbStyle = globalvar.FNPageStyle
if globalvar.hasAgw:
@@ -230,18 +230,22 @@
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
# 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
# create 'search module' notebook page
self.search = MenuTreeWindow(parent = self)
self.notebook.AddPage(self.search, text = _("Search module"))
+ self.notebookPages['search'] = self.search
# create 'python shell' notebook page
self.pyshell = PyShellWindow(parent = self)
self.notebook.AddPage(self.pyshell, text = _("Python shell"))
+ self.notebookPages['pyshell'] = self.pyshell
# bindings
self.gm_cb.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnCBPageChanged)
@@ -249,20 +253,29 @@
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.notebook.SetSelection(self.notebook.GetPageCount() - 1)
+ self.notebookPages['nviz'] = self.nviz
+ self.SetNBPage('nviz')
def RemoveNviz(self):
"""!Remove nviz notebook page"""
# print self.notebook.GetPage(1)
- self.notebook.RemovePage(3)
+ self.notebook.RemovePage(self.GetNBPageIndex('nviz'))
del self.nviz
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
def WorkspaceChanged(self):
"""!Update window title"""
@@ -1302,7 +1315,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('raster')
def OnAddRaster3D(self, event):
@@ -1338,7 +1351,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('vector')
def OnAddVectorMisc(self, event):
@@ -1355,12 +1368,12 @@
def OnAddVectorTheme(self, event):
"""!Add thematic vector map to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('thememap')
def OnAddVectorChart(self, event):
"""!Add chart vector map to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('themechart')
def OnAddOverlay(self, event):
@@ -1381,32 +1394,32 @@
def OnAddRaster3D(self, event):
"""!Add 3D raster map to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('3d-raster')
def OnAddRasterRGB(self, event):
"""!Add RGB raster map to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('rgb')
def OnAddRasterHIS(self, event):
"""!Add HIS raster map to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('his')
def OnAddRasterShaded(self, event):
"""!Add shaded relief raster map to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('shaded')
def OnAddRasterArrow(self, event):
"""!Add flow arrows raster map to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('rastarrow')
def OnAddRasterNum(self, event):
"""!Add cell number raster map to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('rastnum')
def OnAddCommand(self, event):
@@ -1415,7 +1428,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('command')
# show map display
@@ -1427,7 +1440,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('group')
# show map display
@@ -1435,17 +1448,17 @@
def OnAddGrid(self, event):
"""!Add grid map layer to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('grid')
def OnAddGeodesic(self, event):
"""!Add geodesic line map layer to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('geodesic')
def OnAddRhumb(self, event):
"""!Add rhumb map layer to the current layer tree"""
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('rhumb')
def OnAddLabels(self, event):
@@ -1454,7 +1467,7 @@
if not self.curr_page:
self.NewDisplay(show = True)
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
self.curr_page.maptree.AddLayer('labels')
# show map display
@@ -1507,10 +1520,10 @@
if event.ControlDown():
if kc == wx.WXK_TAB:
# switch layer list / command output
- if self.notebook.GetSelection() == 0:
- self.notebook.SetSelection(1)
+ if self.notebook.GetSelection() == self.GetNBPageIndex('layers'):
+ self.SetNBPage('console')
else:
- self.notebook.SetSelection(0)
+ self.SetNBPage('layers')
try:
ckc = chr(kc)
More information about the grass-commit
mailing list