[GRASS-SVN] r49141 - in grass/branches/releasebranch_6_4:
gui/wxpython/gui_modules lib/python
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 8 05:57:12 EST 2011
Author: martinl
Date: 2011-11-08 02:57:12 -0800 (Tue, 08 Nov 2011)
New Revision: 49141
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
grass/branches/releasebranch_6_4/lib/python/task.py
Log:
wxGUI: fix #1485 and #1380 (WxGUI, menu does not work at all (languages using double-byte characters))
Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py 2011-11-08 10:23:26 UTC (rev 49140)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/menuform.py 2011-11-08 10:57:12 UTC (rev 49141)
@@ -1831,7 +1831,13 @@
"""
# parse the interface decription
if not self.grass_task:
- tree = etree.fromstring(gtask.get_interface_description(cmd))
+ enc = locale.getdefaultlocale()[1]
+ if enc and enc.lower() == "cp932":
+ p = re.compile('encoding="' + enc + '"', re.IGNORECASE)
+ tree = etree.fromstring(p.sub('encoding="utf-8"',
+ gtask.get_interface_description(cmd).decode(enc).encode('utf-8')))
+ else:
+ tree = etree.fromstring(gtask.get_interface_description(cmd))
self.grass_task = gtask.processTask(tree).get_task()
for p in self.grass_task.params:
Modified: grass/branches/releasebranch_6_4/lib/python/task.py
===================================================================
--- grass/branches/releasebranch_6_4/lib/python/task.py 2011-11-08 10:23:26 UTC (rev 49140)
+++ grass/branches/releasebranch_6_4/lib/python/task.py 2011-11-08 10:57:12 UTC (rev 49141)
@@ -440,17 +440,19 @@
return cmdout.replace('grass-interface.dtd', os.path.join(os.getenv('GISBASE'), 'etc', 'grass-interface.dtd'))
def parse_interface(name, parser = processTask, blackList = None):
- """!Parse interface of given GRASS module
-
- @param name name of GRASS module to be parsed
- """
- # enc = locale.getdefaultlocale()[1]
- # if enc and enc.lower() not in ("utf8", "utf-8"):
- # tree = etree.fromstring(getInterfaceDescription(cmd[0]).decode(enc).encode("utf-8"))
- # else:
+ """!Parse interface of given GRASS module
+
+ @param name name of GRASS module to be parsed
+ """
+ enc = locale.getdefaultlocale()[1]
+ if enc and enc.lower() == "cp932":
+ p = re.compile('encoding="' + enc + '"', re.IGNORECASE)
+ tree = etree.fromstring(p.sub('encoding="utf-8"',
+ get_interface_description(name).decode(enc).encode("utf-8")))
+ else:
tree = etree.fromstring(get_interface_description(name))
-
- return parser(tree, blackList = blackList).get_task()
+
+ return parser(tree, blackList = blackList).get_task()
def command_info(cmd):
"""!Returns meta information for any GRASS command as dictionary
More information about the grass-commit
mailing list