[GRASS-SVN] r45547 - in grass/trunk/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 4 10:12:03 EST 2011


Author: martinl
Date: 2011-03-04 07:12:03 -0800 (Fri, 04 Mar 2011)
New Revision: 45547

Modified:
   grass/trunk/gui/wxpython/gis_set.py
   grass/trunk/gui/wxpython/gui_modules/gcmd.py
   grass/trunk/gui/wxpython/gui_modules/utils.py
Log:
some minor fixes in r45545
(merge r45546 from devbr6)


Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2011-03-04 15:09:36 UTC (rev 45546)
+++ grass/trunk/gui/wxpython/gis_set.py	2011-03-04 15:12:03 UTC (rev 45547)
@@ -620,7 +620,6 @@
         disabled = []
         idx = 0
         for mapset in self.listOfMapsets:
-            mapset = utils.UnicodeString(mapset)
             if mapset not in self.listOfMapsetsSelectable or \
                     os.path.isfile(os.path.join(self.gisdbase,
                                                 locationName,

Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py	2011-03-04 15:09:36 UTC (rev 45546)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py	2011-03-04 15:12:03 UTC (rev 45547)
@@ -31,6 +31,7 @@
 import signal
 import locale
 import traceback
+import types
 
 import wx
 
@@ -600,8 +601,8 @@
         ps.stdin.close()
         ps.stdin = None
     
-    stdout, stderr = map(lambda x: utils.DecodeString(x) if x and not 'None' else x, ps.communicate())
-        
+    stdout, stderr = map(lambda x: utils.DecodeString(x) if type(x) is types.StringType else x, ps.communicate())
+    
     ret = ps.returncode
         
     if ret != 0 and parent: 

Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py	2011-03-04 15:09:36 UTC (rev 45546)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py	2011-03-04 15:12:03 UTC (rev 45547)
@@ -642,15 +642,21 @@
     return ret.splitlines()
 
 def DecodeString(string):
-    """!Return decoded string using system locales
+    """!Return decoded string
     
+    String is decoded as unicode, on failure
+    are used system locales.
+
     @param string string to be decoded
     
     @return decoded string
     """
-    enc = locale.getdefaultlocale()[1]
-    if enc:
-        return string.decode(enc)
+    try:
+        return string.decode('utf-8')
+    except LookupError:
+        enc = locale.getdefaultlocale()[1]
+        if enc:
+            return string.decode(enc)
     
     return string
 



More information about the grass-commit mailing list