Browse Source

g.gui.datacatalog: expand current mapset instead of location

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67869 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 9 years ago
parent
commit
67eb40fbdb
2 changed files with 16 additions and 2 deletions
  1. 2 2
      gui/wxpython/datacatalog/frame.py
  2. 14 0
      gui/wxpython/datacatalog/tree.py

+ 2 - 2
gui/wxpython/datacatalog/frame.py

@@ -38,8 +38,8 @@ class DataCatalogFrame(wx.Frame):
         # tree
         self.tree = DataCatalogTree(parent=self.panel, giface=self._giface)
         self.tree.InitTreeItems()
-        self.tree.ExpandCurrentLocation()
-
+        self.tree.ExpandCurrentMapset()
+        
         # buttons
         self.btnClose = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
         self.btnClose.SetToolTipString(_("Close GRASS GIS Data Catalog"))

+ 14 - 0
gui/wxpython/datacatalog/tree.py

@@ -264,6 +264,20 @@ class LocationMapTree(TreeView):
         else:
             Debug.msg(1, "Location <%s> not found" % location)
 
+    def ExpandCurrentMapset(self):
+        """Expand current mapset"""
+        gisenv = gscript.gisenv()
+        location = gisenv['LOCATION_NAME']
+        mapset = gisenv['MAPSET']
+        locationItem = self._model.SearchNodes(name=location, type='location')
+        mapsetItem = None
+        if locationItem:
+            mapsetItem = self._model.SearchNodes(parent=locationItem[0], name=mapset, type='mapset')
+        if mapsetItem:
+            self.Select(mapsetItem[0], select=True)
+            self.ExpandNode(mapsetItem[0], recursive=True)
+        else:
+            Debug.msg(1, "Mapset <%s> not found" % mapset)
 
 class DataCatalogTree(LocationMapTree):
     def __init__(self, parent, giface=None):