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

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 18 17:47:20 EDT 2008


Author: martinl
Date: 2008-03-18 17:47:19 -0400 (Tue, 18 Mar 2008)
New Revision: 30624

Modified:
   grass/trunk/gui/wxpython/gis_set.py
Log:
wxGUI: avoid crashing start-up screen when given location/mapset is not found (or when permission is not given)

Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2008-03-18 20:04:19 UTC (rev 30623)
+++ grass/trunk/gui/wxpython/gis_set.py	2008-03-18 21:47:19 UTC (rev 30624)
@@ -198,13 +198,23 @@
         if location:
             # list of locations
             self.UpdateLocations(self.gisdbase)
-            self.lblocations.SetSelection(self.listOfLocations.index(location))
-
+            try:
+                self.lblocations.SetSelection(self.listOfLocations.index(location))
+            except ValueError:
+                print >> sys.stderr, _("ERROR: Location <%s> not found in GISDBASE (%s)") %  \
+                    (location, self.gisdbase)
+                
             # list of mapsets
             self.UpdateMapsets(os.path.join(self.gisdbase,location))
-            mapset =self._getRCValue("MAPSET")
-            if  mapset:
-                self.lbmapsets.SetSelection(self.listOfMapsets.index(mapset))
+            mapset = self._getRCValue("MAPSET")
+            if mapset:
+                try:
+                    self.lbmapsets.SetSelection(self.listOfMapsets.index(mapset))
+                except ValueError:
+                    self.lbmapsets.Clear()
+                    print >> sys.stderr, _("ERROR: Mapset <%s> not found") % \
+                        (mapset)
+
                 # self.bstart.Enable(True)
 
     def _do_layout(self):



More information about the grass-commit mailing list