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

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jul 4 02:49:28 PDT 2014


Author: martinl
Date: 2014-07-04 02:49:27 -0700 (Fri, 04 Jul 2014)
New Revision: 61150

Modified:
   grass/trunk/gui/wxpython/lmgr/datacatalog.py
Log:
wxGUI/datacatalog: select current location and expand it when loading tree

Modified: grass/trunk/gui/wxpython/lmgr/datacatalog.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/datacatalog.py	2014-07-04 09:40:13 UTC (rev 61149)
+++ grass/trunk/gui/wxpython/lmgr/datacatalog.py	2014-07-04 09:49:27 UTC (rev 61150)
@@ -75,6 +75,7 @@
 
     def LoadItemsDone(self):
         self._loaded = True
+        self.tree.ExpandCurrent()
 
 class LocationMapTree(wx.TreeCtrl):
     def __init__(self, parent):
@@ -257,6 +258,17 @@
             stringm = 'MAPSET='+mapset
             RunCommand('g.gisenv', set=stringm)
 
+    def ExpandCurrent(self):
+        """Expand current location"""
+        location = grass.gisenv()['LOCATION_NAME']
+        item = self.getItemByName(location, self.root)
+        if item is not None:
+            self.SelectItem(item)
+            self.ExpandAllChildren(item)
+            self.EnsureVisible(item)
+        else:
+            Debug.msg(1, "Location <%s> not found" % location)
+
 class DataCatalogTree(LocationMapTree):
     def __init__(self, parent):
         """Data Catalog Tree constructor."""
@@ -471,7 +483,7 @@
         res = dlg.ShowModal()
         dlg.Destroy()
         return res
-    
+
     def _popupMenuLayer(self):
         """Create popup menu for layers"""
         menu = wx.Menu()



More information about the grass-commit mailing list