[GRASS-SVN] r47439 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Aug 4 10:32:53 EDT 2011


Author: martinl
Date: 2011-08-04 07:32:52 -0700 (Thu, 04 Aug 2011)
New Revision: 47439

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
Log:
wxGUI/gselect: don't call g.mapset twice
	       (merge r47438 from trunk)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2011-08-04 14:31:56 UTC (rev 47438)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gselect.py	2011-08-04 14:32:52 UTC (rev 47439)
@@ -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',
@@ -322,18 +318,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