[GRASS-SVN] r45546 - in grass/branches/develbranch_6/gui/wxpython:
. gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Mar 4 10:09:36 EST 2011
Author: martinl
Date: 2011-03-04 07:09:36 -0800 (Fri, 04 Mar 2011)
New Revision: 45546
Modified:
grass/branches/develbranch_6/gui/wxpython/gis_set.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py
Log:
some minor fixes in r45545
Modified: grass/branches/develbranch_6/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gis_set.py 2011-03-03 23:11:24 UTC (rev 45545)
+++ grass/branches/develbranch_6/gui/wxpython/gis_set.py 2011-03-04 15:09:36 UTC (rev 45546)
@@ -622,7 +622,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/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py 2011-03-03 23:11:24 UTC (rev 45545)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gcmd.py 2011-03-04 15:09:36 UTC (rev 45546)
@@ -31,6 +31,7 @@
import signal
import locale
import traceback
+import types
import wx
@@ -599,8 +600,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/branches/develbranch_6/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py 2011-03-03 23:11:24 UTC (rev 45545)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/utils.py 2011-03-04 15:09:36 UTC (rev 45546)
@@ -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