[GRASS-SVN] r63319 - in grass/trunk/gui/wxpython: core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 1 20:19:41 PST 2014


Author: annakrat
Date: 2014-12-01 20:19:41 -0800 (Mon, 01 Dec 2014)
New Revision: 63319

Modified:
   grass/trunk/gui/wxpython/core/workspace.py
   grass/trunk/gui/wxpython/lmgr/frame.py
Log:
wxGUI:workspace loading fixed when multiple 2D displays on Windows

Modified: grass/trunk/gui/wxpython/core/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/core/workspace.py	2014-12-01 17:07:30 UTC (rev 63318)
+++ grass/trunk/gui/wxpython/core/workspace.py	2014-12-02 04:19:41 UTC (rev 63319)
@@ -1232,7 +1232,7 @@
         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

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2014-12-01 17:07:30 UTC (rev 63318)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2014-12-02 04:19:41 UTC (rev 63319)
@@ -104,6 +104,7 @@
         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 @@
         
         # 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 @@
             
             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 @@
                 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 @@
         # 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)



More information about the grass-commit mailing list