Browse Source

wxGUI:workspace loading fixed when multiple 2D displays on Windows

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@63319 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 10 years ago
parent
commit
d2f069fed3
2 changed files with 12 additions and 2 deletions
  1. 1 1
      gui/wxpython/core/workspace.py
  2. 11 1
      gui/wxpython/lmgr/frame.py

+ 1 - 1
gui/wxpython/core/workspace.py

@@ -1232,7 +1232,7 @@ class WriteWorkspaceFile(object):
         self.indent -= 4
         self.file.write('%s</focus>\n' % (' ' * self.indent))
         # rotation
-        rotation = ','.join([str(i) for i in iview['rotation']]) if iview['rotation'] else ''
+        rotation = ','.join([str(i) for i in iview['rotation']]) if iview.get('rotation', '') else ''
         self.file.write('%s<rotation>%s</rotation>\n' % (' ' * self.indent, rotation))
 
         # background

+ 11 - 1
gui/wxpython/lmgr/frame.py

@@ -104,6 +104,7 @@ class GMFrame(wx.Frame):
         self.currentPageNum  = None       # currently selected page number for layer tree notebook
         self.workspaceFile = workspace    # workspace file
         self.workspaceChanged = False     # track changes in workspace
+        self.loadingWorkspace = False     # if we are currently loading workspace to ignore some events
         self.cwdPath = None               # current working directory
 
         wx.Frame.__init__(self, parent = parent, id = id, size = size,
@@ -1199,8 +1200,9 @@ class GMFrame(wx.Frame):
         
         # delete current layer tree content
         self.OnWorkspaceClose()
-        
+        self.loadingWorkspace = True
         self.LoadWorkspaceFile(filename)
+        self.loadingWorkspace = False
 
         self.workspaceFile = filename
         self._setTitle()
@@ -1285,6 +1287,8 @@ class GMFrame(wx.Frame):
             
             displayId += 1
             mapdisp.Show() # show mapdisplay
+            # set render property to False to speed up loading layers
+            mapdisp.mapWindowProperties.autoRender = False
 
         maptree = None
         selectList = []  # list of selected layers
@@ -1315,6 +1319,10 @@ class GMFrame(wx.Frame):
                 maptree.SelectItem(layer, select=False)
 
         busy.Destroy()
+
+        # set render property again when all layers are loaded
+        for i, display in enumerate(gxwXml.displays):
+            mapdisplay[i].mapWindowProperties.autoRender = display['render']
             
         for idx, mdisp in enumerate(mapdisplay):
             ### avoid double-rendering when loading workspace
@@ -1812,6 +1820,8 @@ class GMFrame(wx.Frame):
         # moved from mapdisp/frame.py
         # TODO: why it is called 3 times when getting focus?
         # and one times when loosing focus?
+        if self.loadingWorkspace:
+            return
         pgnum = self.notebookLayers.GetPageIndex(notebookLayerPage)
         if pgnum > -1:
             self.notebookLayers.SetSelection(pgnum)