[GRASS-SVN] r41396 - grass/branches/releasebranch_6_4/gui/wxpython

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 12 08:19:45 EST 2010


Author: martinl
Date: 2010-03-12 08:19:45 -0500 (Fri, 12 Mar 2010)
New Revision: 41396

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py
Log:
wxGUI: don't fail when on LC_ALL=C


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py	2010-03-12 13:10:40 UTC (rev 41395)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gis_set.py	2010-03-12 13:19:45 UTC (rev 41396)
@@ -201,8 +201,14 @@
                 self.gisdbase = os.getenv("HOME")
             else:
                 self.gisdbase = os.getcwd()
-        self.tgisdbase.SetValue(self.gisdbase)
-
+        try:
+            self.tgisdbase.SetValue(self.gisdbase)
+        except UnicodeDecodeError:
+            wx.MessageBox(parent = self, caption = _("Error"),
+                          message = _("Unable to set GRASS database. "
+                                      "Check your locale settings."),
+                          style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
+        
         self.OnSetDatabase(None)
         location = self.GetRCValue("LOCATION_NAME")
         if location == "<UNKNOWN>" or \
@@ -537,13 +543,19 @@
         """Update list of locations"""
         self.listOfLocations = []
 
-        for location in glob.glob(os.path.join(dbase, "*")):
-            try:
-                if os.path.join(location, "PERMANENT") in glob.glob(os.path.join(location, "*")):
-                    self.listOfLocations.append(os.path.basename(location))
-            except:
-                pass
-
+        try:
+            for location in glob.glob(os.path.join(dbase, "*")):
+                try:
+                    if os.path.join(location, "PERMANENT") in glob.glob(os.path.join(location, "*")):
+                        self.listOfLocations.append(os.path.basename(location))
+                except:
+                    pass
+        except UnicodeError:
+            wx.MessageBox(parent = self, caption = _("Error"),
+                          message = _("Unable to set GRASS database. "
+                                      "Check your locale settings."),
+                          style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
+        
         utils.ListSortLower(self.listOfLocations)
 
         self.lblocations.Clear()



More information about the grass-commit mailing list