[GRASS-SVN] r71168 - grass/branches/releasebranch_7_2/gui/wxpython/lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 7 06:38:26 PDT 2017


Author: annakrat
Date: 2017-06-07 06:38:25 -0700 (Wed, 07 Jun 2017)
New Revision: 71168

Modified:
   grass/branches/releasebranch_7_2/gui/wxpython/lmgr/frame.py
   grass/branches/releasebranch_7_2/gui/wxpython/lmgr/layertree.py
Log:
wxGUI: remove decorations when creating new workspace, see #3350 (merge from trunk, r71165)

Modified: grass/branches/releasebranch_7_2/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/lmgr/frame.py	2017-06-07 12:59:08 UTC (rev 71167)
+++ grass/branches/releasebranch_7_2/gui/wxpython/lmgr/frame.py	2017-06-07 13:38:25 UTC (rev 71168)
@@ -832,6 +832,10 @@
 
             return mlist
 
+    def GetAllMapDisplays(self):
+        """Get all (open) map displays"""
+        return self.GetMapDisplay(onlyCurrent=False)
+
     def GetLogWindow(self):
         """Gets console for command output and messages"""
         return self._gconsole
@@ -1294,12 +1298,12 @@
         if not self.currentPage:
             self.NewDisplay()
 
-        maptree = self.GetLayerTree()
+        maptrees = [self.notebookLayers.GetPage(i).maptree for i in range(self.notebookLayers.GetPageCount())]
 
         # ask user to save current settings
         if self.workspaceFile and self.workspaceChanged:
             self.OnWorkspaceSave()
-        elif self.workspaceFile is None and maptree.GetCount() > 0:
+        elif self.workspaceFile is None and any(tree.GetCount() for tree in maptrees):
             dlg = wx.MessageDialog(
                 self,
                 message=_(
@@ -1317,12 +1321,14 @@
 
             dlg.Destroy()
 
-        # delete all items
-        maptree.DeleteAllItems()
+        # delete all layers in map displays
+        for maptree in maptrees:
+            maptree.DeleteAllLayers()
 
-        # add new root element
-        maptree.root = maptree.AddRoot("Map Layers")
-        self.GetLayerTree().SetPyData(maptree.root, (None, None))
+        # delete all decorations
+        for display in self.GetAllMapDisplays():
+            for overlayId in display.decorations.keys():
+                display.RemoveOverlay(overlayId)
 
         # no workspace file loaded
         self.workspaceFile = None

Modified: grass/branches/releasebranch_7_2/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/lmgr/layertree.py	2017-06-07 12:59:08 UTC (rev 71167)
+++ grass/branches/releasebranch_7_2/gui/wxpython/lmgr/layertree.py	2017-06-07 13:38:25 UTC (rev 71168)
@@ -1508,6 +1508,13 @@
 
         return layer
 
+    def DeleteAllLayers(self):
+        """Delete all items in the tree"""
+        self.DeleteAllItems()
+        # add new root element
+        self.root = self.AddRoot(_("Map Layers"))
+        self.SetPyData(self.root, (None, None))
+
     def PropertiesDialog(self, layer, show=True):
         """Launch the properties dialog"""
         ltype = self.GetLayerInfo(layer, key='type')



More information about the grass-commit mailing list