[GRASS-SVN] r46514 - in grass/trunk/gui/wxpython: . gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jun 2 08:09:51 EDT 2011
Author: annakrat
Date: 2011-06-02 05:09:51 -0700 (Thu, 02 Jun 2011)
New Revision: 46514
Modified:
grass/trunk/gui/wxpython/gui_modules/gselect.py
grass/trunk/gui/wxpython/gui_modules/layertree.py
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/toolbars.py
grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: selection of tabs in Layer Manager's notebook changed
Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-06-02 09:37:36 UTC (rev 46513)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py 2011-06-02 12:09:51 UTC (rev 46514)
@@ -337,7 +337,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/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py 2011-06-02 09:37:36 UTC (rev 46513)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py 2011-06-02 12:09:51 UTC (rev 46514)
@@ -668,7 +668,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/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-06-02 09:37:36 UTC (rev 46513)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-06-02 12:09:51 UTC (rev 46514)
@@ -1222,7 +1222,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
@@ -1617,7 +1617,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"
@@ -1658,8 +1658,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/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py 2011-06-02 09:37:36 UTC (rev 46513)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py 2011-06-02 12:09:51 UTC (rev 46514)
@@ -1209,7 +1209,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)
@@ -1401,7 +1401,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')
@@ -1444,7 +1444,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/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2011-06-02 09:37:36 UTC (rev 46513)
+++ grass/trunk/gui/wxpython/wxgui.py 2011-06-02 12:09:51 UTC (rev 46514)
@@ -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"""
@@ -1243,7 +1256,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):
@@ -1279,7 +1292,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):
@@ -1296,12 +1309,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):
@@ -1322,32 +1335,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):
@@ -1356,7 +1369,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
@@ -1368,7 +1381,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
@@ -1376,17 +1389,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):
@@ -1395,7 +1408,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
@@ -1448,10 +1461,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