[GRASS-SVN] r47794 - in grass/trunk/gui: icons/grass wxpython
wxpython/gui_modules wxpython/icons
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 21 09:47:50 EDT 2011
Author: annakrat
Date: 2011-08-21 06:47:50 -0700 (Sun, 21 Aug 2011)
New Revision: 47794
Added:
grass/trunk/gui/icons/grass/3d-help.png
grass/trunk/gui/icons/grass/3d-settings.png
Removed:
grass/trunk/gui/icons/grass/3d-fringe.png
grass/trunk/gui/icons/grass/3d-light.png
grass/trunk/gui/icons/grass/3d-raster.png
grass/trunk/gui/icons/grass/3d-vector.png
grass/trunk/gui/icons/grass/3d-view.png
grass/trunk/gui/icons/grass/3d-volume.png
Modified:
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/nviz_preferences.py
grass/trunk/gui/wxpython/gui_modules/toolbars.py
grass/trunk/gui/wxpython/icons/icon.py
grass/trunk/gui/wxpython/wxgui.py
Log:
wxNviz/wxGUI: changed wxNviz toolbar and moved to layer manager, changes in MapFrame AuiManager
Deleted: grass/trunk/gui/icons/grass/3d-fringe.png
===================================================================
(Binary files differ)
Added: grass/trunk/gui/icons/grass/3d-help.png
===================================================================
(Binary files differ)
Property changes on: grass/trunk/gui/icons/grass/3d-help.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: grass/trunk/gui/icons/grass/3d-light.png
===================================================================
(Binary files differ)
Deleted: grass/trunk/gui/icons/grass/3d-raster.png
===================================================================
(Binary files differ)
Added: grass/trunk/gui/icons/grass/3d-settings.png
===================================================================
(Binary files differ)
Property changes on: grass/trunk/gui/icons/grass/3d-settings.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Deleted: grass/trunk/gui/icons/grass/3d-vector.png
===================================================================
(Binary files differ)
Deleted: grass/trunk/gui/icons/grass/3d-view.png
===================================================================
(Binary files differ)
Deleted: grass/trunk/gui/icons/grass/3d-volume.png
===================================================================
(Binary files differ)
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-08-21 12:13:42 UTC (rev 47793)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-08-21 13:47:50 UTC (rev 47794)
@@ -252,7 +252,7 @@
# Update fancy gui style
#
self._mgr.AddPane(self.MapWindow, wx.aui.AuiPaneInfo().CentrePane().
- Dockable(False).BestSize((-1,-1)).
+ Dockable(False).BestSize((-1,-1)).Name('2d').
CloseButton(False).DestroyOnClose(True).
Layer(0))
self._mgr.Update()
@@ -317,21 +317,23 @@
Map = self.Map, tree = self.tree,
lmgr = self._layerManager)
self.MapWindowVDigit.Show()
+ self._mgr.AddPane(self.MapWindowVDigit, wx.aui.AuiPaneInfo().CentrePane().
+ Dockable(False).BestSize((-1,-1)).Name('vdigit').
+ CloseButton(False).DestroyOnClose(True).
+ Layer(0))
self.MapWindow = self.MapWindowVDigit
- self._mgr.DetachPane(self.MapWindow2D)
- self.MapWindow2D.Hide()
-
+ if self._mgr.GetPane('2d').IsShown():
+ self._mgr.GetPane('2d').Hide()
+ elif self._mgr.GetPane('3d').IsShown():
+ self._mgr.GetPane('3d').Hide()
+ self._mgr.GetPane('vdigit').Show()
self.toolbars['vdigit'] = toolbars.VDigitToolbar(parent = self, mapcontent = self.Map,
layerTree = self.tree,
log = log)
self.MapWindowVDigit.SetToolbar(self.toolbars['vdigit'])
- self._mgr.AddPane(self.MapWindowVDigit, wx.aui.AuiPaneInfo().CentrePane().
- Dockable(False).BestSize((-1,-1)).
- CloseButton(False).DestroyOnClose(True).
- Layer(0))
self._mgr.AddPane(self.toolbars['vdigit'],
wx.aui.AuiPaneInfo().
Name("vdigittoolbar").Caption(_("Vector Digitizer Toolbar")).
@@ -346,8 +348,8 @@
self.MapWindow.pen = wx.Pen(colour = 'red', width = 2, style = wx.SOLID)
self.MapWindow.polypen = wx.Pen(colour = 'green', width = 2, style = wx.SOLID)
- def _addToolbarNviz(self):
- """!Add 3D view mode toolbar
+ def AddNviz(self):
+ """!Add 3D view mode window
"""
import nviz
@@ -360,8 +362,6 @@
"Switching back to 2D display mode.\n\nDetails: %s" % nviz.errorMsg))
return
- # add Nviz toolbar and disable 2D display mode tools
- self.toolbars['nviz'] = toolbars.NvizToolbar(self, self.Map)
# disable 3D mode for other displays
for page in range(0, self._layerManager.gm_cb.GetPageCount()):
if self._layerManager.gm_cb.GetPage(page) != self._layerManager.curr_page:
@@ -379,7 +379,7 @@
switchPage = False)
self.statusbar.SetStatusText(_("Please wait, loading data..."), 0)
- # create GL window & NVIZ toolbar
+ # create GL window
if not self.MapWindow3D:
self.MapWindow3D = nviz.GLWindow(self, id = wx.ID_ANY,
Map = self.Map, tree = self.tree, lmgr = self._layerManager)
@@ -390,8 +390,15 @@
self.MapWindow3D.UpdateOverlays()
# add Nviz notebookpage
- self._layerManager.AddNviz()
+ self._layerManager.AddNvizTools()
+ # switch from MapWindow to MapWindowGL
+ self._mgr.GetPane('2d').Hide()
+ self._mgr.AddPane(self.MapWindow3D, wx.aui.AuiPaneInfo().CentrePane().
+ Dockable(False).BestSize((-1,-1)).Name('3d').
+ CloseButton(False).DestroyOnClose(True).
+ Layer(0))
+
self.MapWindow3D.OnPaint(None) # -> LoadData
self.MapWindow3D.Show()
self.MapWindow3D.UpdateView(None)
@@ -402,30 +409,37 @@
del os.environ['GRASS_REGION']
self.MapWindow3D.UpdateOverlays()
+
+ # switch from MapWindow to MapWindowGL
+ self._mgr.GetPane('2d').Hide()
+ self._mgr.GetPane('3d').Show()
+
# add Nviz notebookpage
- self._layerManager.AddNviz()
+ self._layerManager.AddNvizTools()
+
for page in ('view', 'light', 'fringe', 'constant', 'cplane'):
self._layerManager.nviz.UpdatePage(page)
-
- # switch from MapWindow to MapWindowGL
- # add nviz toolbar
- self._mgr.DetachPane(self.MapWindow2D)
- self.MapWindow2D.Hide()
- self._mgr.AddPane(self.MapWindow3D, wx.aui.AuiPaneInfo().CentrePane().
- Dockable(False).BestSize((-1,-1)).
- CloseButton(False).DestroyOnClose(True).
- Layer(0))
- self._mgr.AddPane(self.toolbars['nviz'],
- wx.aui.AuiPaneInfo().
- Name("nviztoolbar").Caption(_("3D View Toolbar")).
- ToolbarPane().Top().Row(1).
- LeftDockable(False).RightDockable(False).
- BottomDockable(False).TopDockable(True).
- CloseButton(False).Layer(2).
- BestSize((self.toolbars['nviz'].GetBestSize())))
self.SetStatusText("", 0)
+ self._mgr.Update()
+
+ def RemoveNviz(self):
+ """!Restore 2D view"""
+ self.statusbar.SetStatusText(_("Please wait, unloading data..."), 0)
+ self._layerManager.goutput.WriteCmdLog(_("Switching back to 2D view mode..."),
+ switchPage = False)
+ self.MapWindow3D.UnloadDataLayers(force = True)
+ # switch from MapWindowGL to MapWindow
+ self._mgr.GetPane('2d').Show()
+ self._mgr.GetPane('3d').Hide()
+
+ self.MapWindow = self.MapWindow2D
+ # remove nviz notebook page
+ self._layerManager.RemoveNvizTools()
+ self.MapWindow.UpdateMap()
+ self._mgr.Update()
+
def AddToolbar(self, name):
"""!Add defined toolbar to the window
@@ -434,7 +448,6 @@
- 'vdigit' - vector digitizer
- 'gcpdisp' - GCP Manager Display
- 'georect' - georectifier
- - 'nviz' - 3D view mode
"""
# default toolbar
if name == "map":
@@ -486,40 +499,20 @@
self.toolbars[name] = None
if name == 'vdigit':
- self._mgr.DetachPane(self.MapWindowVDigit)
- self.MapWindowVDigit.Hide()
- self.MapWindow2D.Show()
- self._mgr.AddPane(self.MapWindow2D, wx.aui.AuiPaneInfo().CentrePane().
- Dockable(False).BestSize((-1,-1)).
- CloseButton(False).DestroyOnClose(True).
- Layer(0))
+ self._mgr.GetPane('vdigit').Hide()
+ self._mgr.GetPane('2d').Show()
self.MapWindow = self.MapWindow2D
-
- elif name == 'nviz':
- self.statusbar.SetStatusText(_("Please wait, unloading data..."), 0)
- self._layerManager.goutput.WriteCmdLog(_("Switching back to 2D view mode..."),
- switchPage = False)
- self.MapWindow3D.UnloadDataLayers(force = True)
- # switch from MapWindowGL to MapWindow
- self._mgr.DetachPane(self.MapWindow3D)
- self.MapWindow3D.Hide()
- self.MapWindow2D.Show()
- self._mgr.AddPane(self.MapWindow2D, wx.aui.AuiPaneInfo().CentrePane().
- Dockable(False).BestSize((-1,-1)).
- CloseButton(False).DestroyOnClose(True).
- Layer(0))
- self.MapWindow = self.MapWindow2D
- # remove nviz notebook page
- self._layerManager.RemoveNviz()
- self.MapWindow.UpdateMap()
-
self.toolbars['map'].combo.SetValue(_("2D view"))
self.toolbars['map'].Enable2D(True)
self.statusbarWin['toggle'].Enable(True)
self._mgr.Update()
-
+
+ def IsPaneShown(self, name):
+ """!Check if pane (toolbar, mapWindow ...) of given name is currently shown"""
+ return self._mgr.GetPane(name).IsShown()
+
def _initDisplay(self):
"""!Initialize map display, set dimensions and map region
"""
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_preferences.py 2011-08-21 12:13:42 UTC (rev 47793)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_preferences.py 2011-08-21 13:47:50 UTC (rev 47794)
@@ -32,7 +32,7 @@
settings = UserSettings):
PreferencesBaseDialog.__init__(self, parent = parent, title = title,
settings = settings)
- self.toolWin = self.parent.GetLayerManager().nviz
+ self.toolWin = self.parent.nviz
self.win = dict()
# create notebook pages
Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py 2011-08-21 12:13:42 UTC (rev 47793)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py 2011-08-21 13:47:50 UTC (rev 47794)
@@ -10,7 +10,7 @@
- GCPDisplayToolbar
- VDigitToolbar
- ProfileToolbar
- - NvizToolbar
+ - LMNvizToolbar
- ModelToolbar
- HistogramToolbar
- LMWorkspaceToolbar
@@ -148,10 +148,10 @@
'desc' : self.defaultAction.get('desc', '') }
def FixSize(self, width):
- """!Fix toolbar width on Windows
-
- @todo Determine why combobox causes problems here
- """
+ """!Fix toolbar width on Windows
+
+ @todo Determine why combobox causes problems here
+ """
if platform.system() == 'Windows':
size = self.GetBestSize()
self.SetSize((size[0] + width, size[1]))
@@ -318,9 +318,9 @@
self.Enable2D(True)
elif tool == self.toolId['3d'] and \
- not self.parent.toolbars['nviz']:
+ not (self.parent.MapWindow3D and self.parent.IsPaneShown('3d')):
self.ExitToolbars()
- self.parent.AddToolbar("nviz")
+ self.parent.AddNviz()
elif tool == self.toolId['vdigit'] and \
not self.parent.toolbars['vdigit']:
@@ -331,8 +331,8 @@
def ExitToolbars(self):
if self.parent.toolbars['vdigit']:
self.parent.toolbars['vdigit'].OnExit()
- if self.parent.toolbars['nviz']:
- self.parent.toolbars['nviz'].OnExit()
+ if self.parent.GetLayerManager().IsPaneShown('toolbarNviz'):
+ self.parent.RemoveNviz()
def Enable2D(self, enabled):
"""!Enable/Disable 2D display mode specific tools"""
@@ -1212,12 +1212,11 @@
self.parent.OnQuit),
))
-class NvizToolbar(AbstractToolbar):
+class LMNvizToolbar(AbstractToolbar):
"""!Nviz toolbar
"""
- def __init__(self, parent, mapcontent):
- self.mapcontent = mapcontent
- self.lmgr = parent.GetLayerManager()
+ def __init__(self, parent):
+ self.lmgr = parent
AbstractToolbar.__init__(self, parent)
@@ -1232,60 +1231,18 @@
def _toolbarData(self):
"""!Toolbar data"""
icons = Icons['nviz']
- return self._getToolbarData((("view", icons["view"],
- self.OnShowPage),
- (None, ),
- ("surface", icons["surface"],
- self.OnShowPage),
- ("vector", icons["vector"],
- self.OnShowPage),
- ("volume", icons["volume"],
- self.OnShowPage),
- (None, ),
- ("light", icons["light"],
- self.OnShowPage),
- ("fringe", icons["fringe"],
- self.OnShowPage),
- (None, ),
- ("nviz_cmd", icons['nviz_cmd'],
+ return self._getToolbarData((("nviz_cmd", icons['nviz_cmd'],
self.OnNvizCmd),
+ (None, ),
("settings", icons["settings"],
self.OnSettings),
- ("help", Icons['misc']["help"],
- self.OnHelp),
- (None, ),
- ('quit', icons["quit"],
- self.OnExit))
+ ("help", icons["help"],
+ self.OnHelp))
)
-
- def OnShowPage(self, event):
- """!Go to the selected page"""
- if not self.lmgr or not hasattr(self.lmgr, "nviz"):
- event.Skip()
- return
- self.lmgr.notebook.SetSelectionByName('nviz')
- eId = event.GetId()
- if eId == self.view:
- self.lmgr.nviz.SetPage('view')
- elif eId == self.surface:
- self.lmgr.nviz.SetPage('surface')
- elif eId == self.surface:
- self.lmgr.nviz.SetPage('surface')
- elif eId == self.vector:
- self.lmgr.nviz.SetPage('vector')
- elif eId == self.volume:
- self.lmgr.nviz.SetPage('volume')
- elif eId == self.light:
- self.lmgr.nviz.SetPage('light')
- elif eId == self.fringe:
- self.lmgr.nviz.SetPage('fringe')
-
- self.lmgr.Raise()
-
def OnNvizCmd(self, event):
"""!Show nviz_cmd command"""
- self.parent.MapWindow.OnNvizCmd()
+ self.lmgr.GetLayerTree().GetMapDisplay().GetWindow().OnNvizCmd()
def OnHelp(self, event):
"""!Show 3D view mode help"""
@@ -1302,20 +1259,7 @@
if not self.settingsDialog:
self.settingsDialog = NvizPreferencesDialog(parent = self.parent)
self.settingsDialog.Show()
-
- def OnExit (self, event = None):
- """!Quit nviz tool (swith to 2D mode)"""
- # set default mouse settings
- self.parent.MapWindow.mouse['use'] = "pointer"
- self.parent.MapWindow.mouse['box'] = "point"
- self.parent.MapWindow.polycoords = []
- # return to map layer page (gets rid of ugly exit bug)
- self.lmgr.notebook.SetSelectionByName('layers')
-
- # disable the toolbar
- self.parent.RemoveToolbar("nviz")
-
class ModelToolbar(AbstractToolbar):
"""!Graphical modeler toolbar (see gmodeler.py)
"""
Modified: grass/trunk/gui/wxpython/icons/icon.py
===================================================================
--- grass/trunk/gui/wxpython/icons/icon.py 2011-08-21 12:13:42 UTC (rev 47793)
+++ grass/trunk/gui/wxpython/icons/icon.py 2011-08-21 13:47:50 UTC (rev 47794)
@@ -333,33 +333,14 @@
desc = _('Settings dialog for georectification tool')),
},
'nviz' : {
- 'view' : MetaIcon(img = iconSet.get('3d-view', wx.ART_ERROR),
- label = _('Switch to view control page'),
- desc = _('Change view settings')),
- 'surface' : MetaIcon(img = iconSet.get('3d-raster', wx.ART_ERROR),
- label = _('Switch to surface (raster) control page'),
- desc = _('Change surface (loaded raster maps) settings')),
- 'vector' : MetaIcon(img = iconSet.get('3d-vector', wx.ART_ERROR),
- label = _('Switch to vector (2D/3D) control page'),
- desc = _('Change 2D/3D vector settings')),
- 'volume' : MetaIcon(img = iconSet.get('3d-volume', wx.ART_ERROR),
- label = _('Switch to volume (3D raster) control page'),
- desc = _('Change volume (loaded 3D raster maps) settings')),
- 'light' : MetaIcon(img = iconSet.get('3d-light', wx.ART_ERROR),
- label = _('Switch to lighting control page'),
- desc = _('Change lighting settings')),
- 'fringe' : MetaIcon(img = iconSet.get('3d-fringe', wx.ART_ERROR),
- label = _('Switch to fringe control page'),
- desc = _('Switch on/off fringes')),
'nviz_cmd': MetaIcon(img = iconSet.get('script-save', wx.ART_ERROR),
label = _('Generate command for nviz_cmd'),
desc = _('Generate command for nviz_cmd based on current state')),
- 'settings': MetaIcon(img = iconSet.get('settings', wx.ART_ERROR),
- label = _('3D view mode tools'),
- desc = _('Show/hide 3D view mode settings dialog')),
- 'quit' : MetaIcon(img = iconSet.get('quit', wx.ART_ERROR),
- label = _('Quit 3D view mode'),
- desc = _('Switch back to 2D view mode')),
+ 'settings': MetaIcon(img = iconSet.get('3d-settings', wx.ART_ERROR),
+ label = _('3D view mode settings'),
+ desc = _('Show 3D view mode settings dialog')),
+ 'help' : MetaIcon(img = iconSet.get('3d-help', wx.ART_ERROR),
+ label = _('Show 3D view mode manual')),
},
'modeler' : {
'new' : MetaIcon(img = iconSet.get('create', wx.ART_ERROR),
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2011-08-21 12:13:42 UTC (rev 47793)
+++ grass/trunk/gui/wxpython/wxgui.py 2011-08-21 13:47:50 UTC (rev 47794)
@@ -78,7 +78,8 @@
from gui_modules import psmap
from gui_modules.debug import Debug
from gui_modules.ghelp import MenuTreeWindow, AboutWindow, InstallExtensionWindow
-from gui_modules.toolbars import LMWorkspaceToolbar, LMDataToolbar, LMToolsToolbar, LMMiscToolbar, LMVectorToolbar
+from gui_modules.toolbars import LMWorkspaceToolbar, LMDataToolbar, LMToolsToolbar,\
+ LMMiscToolbar, LMVectorToolbar, LMNvizToolbar
from gui_modules.gpyshell import PyShellWindow
from icons.icon import Icons
@@ -128,7 +129,8 @@
'data' : LMDataToolbar(parent = self),
'tools' : LMToolsToolbar(parent = self),
'misc' : LMMiscToolbar(parent = self),
- 'vector' : LMVectorToolbar(parent = self) }
+ 'vector' : LMVectorToolbar(parent = self),
+ 'nviz' : LMNvizToolbar(parent = self)}
self._toolbarsData = { 'workspace' : ("toolbarWorkspace", # name
_("Workspace Toolbar"), # caption
1), # row
@@ -144,13 +146,16 @@
'vector' : ("toolbarVector",
_("Vector Toolbar"),
2),
+ 'nviz' : ("toolbarNviz",
+ _("3D view Toolbar"),
+ 2),
}
if sys.platform == 'win32':
self._toolbarsList = ('workspace', 'data',
- 'vector', 'tools', 'misc')
+ 'vector', 'tools', 'misc', 'nviz')
else:
self._toolbarsList = ('data', 'workspace',
- 'misc', 'tools', 'vector')
+ 'nviz', 'misc', 'tools', 'vector')
for toolbar in self._toolbarsList:
name, caption, row = self._toolbarsData[toolbar]
self._auimgr.AddPane(self.toolbars[toolbar],
@@ -162,6 +167,7 @@
CloseButton(False).Layer(2).
BestSize((self.toolbars[toolbar].GetBestSize())))
+ self._auimgr.GetPane('toolbarNviz').Hide()
# bindings
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
@@ -231,7 +237,11 @@
def _setCopyingOfSelectedText(self):
copy = UserSettings.Get(group = 'manager', key = 'copySelectedTextToClipboard', subkey = 'enabled')
self.goutput.SetCopyingOfSelectedText(copy)
-
+
+ def IsPaneShown(self, name):
+ """!Check if pane (toolbar, ...) of given name is currently shown"""
+ return self._auimgr.GetPane(name).IsShown()
+
def _createNoteBook(self):
"""!Creates notebook widgets"""
self.notebook = menuform.GNotebook(parent = self, style = globalvar.FNPageDStyle)
@@ -270,9 +280,17 @@
return self.notebook
- def AddNviz(self):
+ def AddNvizTools(self):
"""!Add nviz notebook page"""
- Debug.msg(5, "GMFrame.AddNviz(): begin")
+ Debug.msg(5, "GMFrame.AddNvizTools()")
+ # show toolbar
+ self._auimgr.GetPane('toolbarNviz').Show()
+ # reorder other toolbars
+ for pos, toolbar in enumerate(('toolbarNviz', 'toolbarVector', 'toolbarTools', 'toolbarMisc')):
+ self._auimgr.GetPane(toolbar).Row(2).Position(pos)
+ self._auimgr.Update()
+
+ # create nviz tools tab
self.nviz = nviz_tools.NvizToolWindow(parent = self,
display = self.curr_page.maptree.GetMapDisplay())
idx = self.notebook.GetPageIndexByName('layers')
@@ -280,13 +298,18 @@
self.notebook.SetSelectionByName('nviz')
- def RemoveNviz(self):
+ def RemoveNvizTools(self):
"""!Remove nviz notebook page"""
- # print self.notebook.GetPage(1)
+ # if more mapwindow3D were possible, check here if nb page should be removed
+ self.notebook.SetSelectionByName('layers')
self.notebook.RemovePage(self.notebook.GetPageIndexByName('nviz'))
del self.nviz
- self.notebook.SetSelectionByName('layers')
-
+ # hide toolbar
+ self._auimgr.GetPane('toolbarNviz').Hide()
+ for pos, toolbar in enumerate(('toolbarVector', 'toolbarTools', 'toolbarMisc')):
+ self._auimgr.GetPane(toolbar).Row(2).Position(pos)
+ self._auimgr.Update()
+
def WorkspaceChanged(self):
"""!Update window title"""
if not self.workspaceChanged:
@@ -1241,7 +1264,7 @@
"g.extension -s extension=wx.wms")
return
- DisplayWMSMenu()
+ DisplayWMSMenu()
def OnNewDisplay(self, event = None):
"""!Create new layer tree and map display instance"""
More information about the grass-commit
mailing list