[GRASS-SVN] r30935 - grass/trunk/gui/wxpython

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Apr 11 08:01:19 EDT 2008


Author: martinl
Date: 2008-04-11 08:01:19 -0400 (Fri, 11 Apr 2008)
New Revision: 30935

Modified:
   grass/trunk/gui/wxpython/gis_set.py
Log:
wxGUI (start-up screen): avoid crashing when deleting currently selected location


Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2008-04-11 09:54:10 UTC (rev 30934)
+++ grass/trunk/gui/wxpython/gis_set.py	2008-04-11 12:01:19 UTC (rev 30935)
@@ -551,7 +551,17 @@
 
         # disable mapset with denied permission
         locationName = os.path.basename(location)
-        if self._getRCValue("LOCATION_NAME") == "<UNKNOWN>":
+
+        try:
+            mapsets = gcmd.Command(['g.mapset',
+                                    '-l',
+                                    'location=%s' % locationName,
+                                    'gisdbase=%s' % self.gisdbase],
+                                   stderr=None)
+
+            for line in mapsets.ReadStdOutput():
+                self.listOfMapsetsSelectable += line.split(' ')
+        except gcmd.CmdError:
             gcmd.Command(["g.gisenv",
                           "set=GISDBASE=%s" % self.gisdbase])
             gcmd.Command(["g.gisenv",
@@ -559,12 +569,6 @@
             gcmd.Command(["g.gisenv",
                           "set=MAPSET=PERMANENT"])
 
-        for line in gcmd.Command(['g.mapset',
-                                  '-l',
-                                  'location=%s' % locationName,
-                                  'gisdbase=%s' % self.gisdbase]).ReadStdOutput():
-            self.listOfMapsetsSelectable += line.split(' ')
-
         disabled = []
         idx = 0
         for mapset in self.listOfMapsets:



More information about the grass-commit mailing list