[GRASS-SVN] r47438 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 4 10:31:56 EDT 2011


Author: martinl
Date: 2011-08-04 07:31:56 -0700 (Thu, 04 Aug 2011)
New Revision: 47438

Modified:
   grass/trunk/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI/gselect: don't call g.mapset twice


Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py	2011-08-04 14:22:56 UTC (rev 47437)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py	2011-08-04 14:31:56 UTC (rev 47438)
@@ -268,10 +268,6 @@
         # get current mapset
         curr_mapset = grass.gisenv()['MAPSET']
         
-        # list of mapsets in current location
-        if mapsets is None:
-            mapsets = utils.ListOfMapsets(get = 'accessible')
-        
         # map element types to g.mlist types
         elementdict = {'cell':'rast',
                        'raster':'rast',
@@ -323,18 +319,20 @@
             self.AddItem(_('Not selectable element'))
             return
         
-        # get directory tree nodes
-        # reorder mapsets based on search path (TODO)
-        for i in range(len(mapsets)):
-            if i > 0 and mapsets[i] == curr_mapset:
-                mapsets[i] = mapsets[0]
-                mapsets[0] = curr_mapset
-        
         if globalvar.have_mlist:
             filesdict = grass.mlist_grouped(elementdict[element])
         else:
             filesdict = grass.list_grouped(elementdict[element])
         
+        # list of mapsets in current location
+        if mapsets is None:
+            mapsets = filesdict.keys()
+        
+        # current mapset first
+        if curr_mapset in mapsets and mapsets[0] != curr_mapset:
+            mapsets.remove(curr_mapset)
+            mapsets.insert(0, curr_mapset)
+        
         first_mapset = None
         for mapset in mapsets:
             mapset_node = self.AddItem('Mapset: ' + mapset)



More information about the grass-commit mailing list