浏览代码

wxNviz: hide GLWindow on exit

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@47362 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 年之前
父节点
当前提交
88269199d8
共有 2 个文件被更改,包括 12 次插入6 次删除
  1. 5 3
      gui/wxpython/gui_modules/mapdisp.py
  2. 7 3
      gui/wxpython/gui_modules/wxnviz.py

+ 5 - 3
gui/wxpython/gui_modules/mapdisp.py

@@ -397,6 +397,7 @@ class MapFrame(wx.Frame):
             self.MapWindow3D.UpdateView(None)
         else:
             self.MapWindow = self.MapWindow3D
+            self.MapWindow3D.GetDisplay().Init()
             self.MapWindow3D.UpdateOverlays()
             # add Nviz notebookpage
             self._layerManager.AddNviz()
@@ -495,11 +496,12 @@ class MapFrame(wx.Frame):
             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)
+            self.MapWindow3D.UnloadDataLayers(force = True)
             # switch from MapWindowGL to MapWindow
             self._mgr.DetachPane(self.MapWindow3D)
-            self.MapWindow3D.Destroy()
-            self.MapWindow3D = None
+            self.MapWindow3D.Hide()
+            #self.MapWindow3D.Destroy()
+            #self.MapWindow3D = None
             self.MapWindow2D.Show()
             self._mgr.AddPane(self.MapWindow2D, wx.aui.AuiPaneInfo().CentrePane().
                               Dockable(False).BestSize((-1,-1)).

+ 7 - 3
gui/wxpython/gui_modules/wxnviz.py

@@ -76,9 +76,7 @@ class Nviz(object):
         G_set_error_routine(errfunc) 
         G_set_percent_routine(perfunc)
         
-        G_unset_window()
-        GS_libinit()
-        GVL_libinit()
+        self.Init()
         
         self.data_obj = nv_data()
         self.data = pointer(self.data_obj)
@@ -94,6 +92,12 @@ class Nviz(object):
         del self.data
         del self.data_obj
         self.log = None
+
+    def Init(self):
+        """!Initialize window"""
+        G_unset_window()
+        GS_libinit()
+        GVL_libinit()
         
     def ResizeWindow(self, width, height):
         """!GL canvas resized