[GRASS-SVN] r64473 - in grass/trunk/gui/wxpython: mapdisp nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 5 08:10:04 PST 2015


Author: annakrat
Date: 2015-02-05 08:10:04 -0800 (Thu, 05 Feb 2015)
New Revision: 64473

Modified:
   grass/trunk/gui/wxpython/mapdisp/frame.py
   grass/trunk/gui/wxpython/nviz/tools.py
Log:
wxGUI/nviz: attempt to fix error on Windows when switching to 3D for the second time due to different order of initialization steps

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2015-02-05 14:47:04 UTC (rev 64472)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2015-02-05 16:10:04 UTC (rev 64473)
@@ -105,6 +105,7 @@
         # Emitted when starting (switching to) 3D mode.
         # Parameter firstTime specifies if 3D was already actived.
         self.starting3dMode = Signal("MapFrame.starting3dMode")
+        self.starting3dModeSetInitialMaps = Signal("MapFrame.starting3dMode")
 
         # Emitted when ending (switching from) 3D mode.
         self.ending3dMode = Signal("MapFrame.ending3dMode")
@@ -392,6 +393,7 @@
             self.MapWindow3D.overlayActivated.connect(self._activateOverlay)
             self.MapWindow3D.overlayHidden.connect(self._hideOverlay)
             self.legend.overlayChanged.connect(self.MapWindow3D.UpdateOverlays)
+            self.starting3dModeSetInitialMaps.emit()
         else:
             self._switchMapWindow(self.MapWindow3D)
             os.environ['GRASS_REGION'] = self.Map.SetRegion(windres = True, windres3 = True)
@@ -406,6 +408,9 @@
             self.starting3dMode.emit(firstTime=False)
 
             self.MapWindow3D.ResetViewHistory()
+            # explicitly load layers so that we can call SetInitialMaps after that
+            self.MapWindow3D.LoadDataLayers()
+            self.starting3dModeSetInitialMaps.emit()
 
         self._giface.updateMap.disconnect(self.MapWindow2D.UpdateMap)
         self._giface.updateMap.connect(self.MapWindow3D.UpdateMap)

Modified: grass/trunk/gui/wxpython/nviz/tools.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/tools.py	2015-02-05 14:47:04 UTC (rev 64472)
+++ grass/trunk/gui/wxpython/nviz/tools.py	2015-02-05 16:10:04 UTC (rev 64473)
@@ -114,6 +114,7 @@
         # bindings
         self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
         self.Bind(wx.EVT_SIZE, self.OnSize)
+        self.mapDisplay.starting3dModeSetInitialMaps.connect(self.SetInitialMaps)
         
         self.mapWindow.GetAnimation().animationFinished.connect(self.OnAnimationFinished)
         self.mapWindow.GetAnimation().animationUpdateIndex.connect(self.OnAnimationUpdateIndex)
@@ -124,7 +125,6 @@
         wx.CallAfter(self.SetPage, 'view')
         wx.CallAfter(self.UpdateScrolling, (self.foldpanelData, self.foldpanelAppear,
                                             self.foldpanelAnalysis))       
-        wx.CallAfter(self.SetInitialMaps)
         
     def SetInitialMaps(self):
         """Set initial raster and vector map"""



More information about the grass-commit mailing list