Browse Source

wxGUI/nviz: fix reopening 3D by reloading layers (#953)

When reopening 3D second time, the layer dictionary doesn't have 'object' yet, but it assumed to be complete by 3D GUI in lmgr (tools.py). Explicit reloading of layers before the tools.py are ready should address this. Normally that's done automatically when GLWindow is created, but 2nd time it is only showed (was hidden) and reloading doesn't happen automatically.
Anna Petrasova 4 năm trước cách đây
mục cha
commit
cfc27fae98
2 tập tin đã thay đổi với 5 bổ sung0 xóa
  1. 1 0
      gui/wxpython/mapdisp/frame.py
  2. 4 0
      gui/wxpython/nviz/mapwindow.py

+ 1 - 0
gui/wxpython/mapdisp/frame.py

@@ -420,6 +420,7 @@ class MapFrame(SingleMapFrame):
             os.environ['GRASS_REGION'] = self.Map.SetRegion(
                 windres=True, windres3=True)
             self.MapWindow3D.GetDisplay().Init()
+            self.MapWindow3D.LoadDataLayers()
             del os.environ['GRASS_REGION']
 
             # switch from MapWindow to MapWindowGL

+ 4 - 0
gui/wxpython/nviz/mapwindow.py

@@ -1350,6 +1350,10 @@ class GLWindow(MapWindowBase, glcanvas.GLCanvas):
             except GException as e:
                 GError(parent=self,
                        message=e.value)
+            # when nviz.tools is not yet ready
+            # during opening 3D view 2nd time
+            except:
+                pass
 
         stop = grass.clock()