Parcourir la source

wxNviz: disable using nviz in more than one map display window

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@46521 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová il y a 14 ans
Parent
commit
8fb27a8a02

+ 7 - 0
gui/wxpython/gui_modules/mapdisp.py

@@ -370,6 +370,11 @@ class MapFrame(wx.Frame):
         
         # 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:
+                if '3D' in self._layerManager.gm_cb.GetPage(page).maptree.mapdisplay.toolbars['map'].combo.GetString(1):
+                    self._layerManager.gm_cb.GetPage(page).maptree.mapdisplay.toolbars['map'].combo.Delete(1)
         self.toolbars['map'].Enable2D(False)
         
         # update status bar
@@ -548,6 +553,8 @@ class MapFrame(wx.Frame):
                 pgnum = self.layerbook.GetPageIndex(self.page)
                 if pgnum > -1:
                     self.layerbook.SetSelection(pgnum)
+                    self._layerManager.curr_page = self.layerbook.GetCurrentPage()
+                    self.layerbook
         
         event.Skip()
         

+ 4 - 0
gui/wxpython/gui_modules/nviz_mapdisp.py

@@ -451,6 +451,10 @@ class GLWindow(MapWindow, glcanvas.GLCanvas):
             type = self.tree.GetPyData(item)[0]['type']
             if item in self.layers:
                 continue
+            # "raster (double click to set properties)" - tries to load this 
+            # layer - no idea how to fix it
+            if ' ' in self.tree.GetPyData(item)[0]['maplayer'].name:
+                return
             try:
                 if type ==  'raster':
                     self.LoadRaster(item)

+ 5 - 2
gui/wxpython/gui_modules/toolbars.py

@@ -204,8 +204,11 @@ class MapToolbar(AbstractToolbar):
             log = self.parent.GetLayerManager().GetLogWindow()
         
         if haveNviz:
-            choices.append(_('3D view'))
-            self.toolId['3d'] = 1
+            if not self.parent.GetLayerManager().existNviz:
+                choices.append(_('3D view'))
+                self.toolId['3d'] = 1
+            else:
+                self.toolId['3d'] = -1
         else:
             from nviz import errorMsg
             log.WriteCmdLog(_('3D view mode not available'))

+ 2 - 0
gui/wxpython/wxgui.py

@@ -119,6 +119,7 @@ class GMFrame(wx.Frame):
         self.workspaceChanged = False     # track changes in workspace
         self.georectifying = None         # reference to GCP class or None
         self.gcpmanagement = None         # reference to GCP class or None
+        self.existNviz = False
         # list of open dialogs
         self.dialogs        = dict()
         self.dialogs['preferences'] = None
@@ -269,6 +270,7 @@ class GMFrame(wx.Frame):
         self.notebook.AddPage(self.nviz, text = _("3D view"))
         self.notebookPages['nviz'] = self.nviz
         self.SetNBPage('nviz')
+        self.existNviz = True
         
     def RemoveNviz(self):
         """!Remove nviz notebook page"""