[GRASS-SVN] r41398 - in grass/branches/develbranch_6/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 12 08:38:05 EST 2010


Author: martinl
Date: 2010-03-12 08:38:04 -0500 (Fri, 12 Mar 2010)
New Revision: 41398

Modified:
   grass/branches/develbranch_6/gui/wxpython/gis_set.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py
Log:
missing backport (r41396)


Modified: grass/branches/develbranch_6/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gis_set.py	2010-03-12 13:21:51 UTC (rev 41397)
+++ grass/branches/develbranch_6/gui/wxpython/gis_set.py	2010-03-12 13:38:04 UTC (rev 41398)
@@ -198,8 +198,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 \
@@ -525,7 +531,13 @@
 
     def UpdateLocations(self, dbase):
         """!Update list of locations"""
-        self.listOfLocations = utils.GetListOfLocations(dbase)
+        try:
+            self.listOfLocations = utils.GetListOfLocations(dbase)
+        except UnicodeEncodeError:
+            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.lblocations.Clear()
         self.lblocations.InsertItems(self.listOfLocations, 0)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py	2010-03-12 13:21:51 UTC (rev 41397)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py	2010-03-12 13:38:04 UTC (rev 41398)
@@ -556,14 +556,17 @@
     @return list of locations (sorted)
     """
     listOfLocations = list()
+
+    try:
+        for location in glob.glob(os.path.join(dbase, "*")):
+            try:
+                if os.path.join(location, "PERMANENT") in glob.glob(os.path.join(location, "*")):
+                    listOfLocations.append(os.path.basename(location))
+            except:
+                pass
+    except UnicodeEncodeError, e:
+        raise e
     
-    for location in glob.glob(os.path.join(dbase, "*")):
-        try:
-            if os.path.join(location, "PERMANENT") in glob.glob(os.path.join(location, "*")):
-                listOfLocations.append(os.path.basename(location))
-        except:
-            pass
-    
     ListSortLower(listOfLocations)
     
     return listOfLocations



More information about the grass-commit mailing list