[GRASS-SVN] r70232 - grass/trunk/gui/wxpython/lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 3 20:06:07 PST 2017


Author: wenzeslaus
Date: 2017-01-03 20:06:06 -0800 (Tue, 03 Jan 2017)
New Revision: 70232

Modified:
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI: support d.erase, extend LayerTree API

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2017-01-03 22:51:37 UTC (rev 70231)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2017-01-04 04:06:06 UTC (rev 70232)
@@ -739,6 +739,11 @@
         """
         if not self.currentPage:
             self.NewDisplay(show=True)
+        # here should be the d.* commands which are not layers
+        if command[0] == 'd.erase':
+            # rest of d.erase is ignored
+            self.GetLayerTree().DeleteAllLayers()
+            return
         try:
             # display GRASS commands
             layertype = command2ltype[command[0]]
@@ -1321,12 +1326,8 @@
             dlg.Destroy()
 
         # delete all items
-        maptree.DeleteAllItems()
+        maptree.DeleteAllLayers()
 
-        # add new root element
-        maptree.root = maptree.AddRoot("Map Layers")
-        self.GetLayerTree().SetPyData(maptree.root, (None, None))
-
         # no workspace file loaded
         self.workspaceFile = None
         self.workspaceChanged = False

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2017-01-03 22:51:37 UTC (rev 70231)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2017-01-04 04:06:06 UTC (rev 70232)
@@ -1477,6 +1477,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