[GRASS-SVN] r37608 -
grass/branches/releasebranch_6_4/gui/wxpython/support
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 30 06:33:42 EDT 2009
Author: martinl
Date: 2009-05-30 06:33:42 -0400 (Sat, 30 May 2009)
New Revision: 37608
Modified:
grass/branches/releasebranch_6_4/gui/wxpython/support/update_menudata.py
Log:
fix update_menudata script to work also with grass64
Modified: grass/branches/releasebranch_6_4/gui/wxpython/support/update_menudata.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/support/update_menudata.py 2009-05-30 10:26:31 UTC (rev 37607)
+++ grass/branches/releasebranch_6_4/gui/wxpython/support/update_menudata.py 2009-05-30 10:33:42 UTC (rev 37608)
@@ -19,11 +19,35 @@
import os
import sys
+import locale
try:
import xml.etree.ElementTree as etree
except ImportError:
import elementtree.ElementTree as etree # Python <= 2.4
+import xml.sax
+import xml.sax.handler
+HandlerBase=xml.sax.handler.ContentHandler
+from xml.sax import make_parser
+
+def ParseInterface(cmd):
+ """!Parse interface
+
+ @param cmd command to be parsed (given as list)
+ """
+ grass_task = menuform.grassTask()
+ handler = menuform.processTask(grass_task)
+ enc = locale.getdefaultlocale()[1]
+ if enc and enc.lower() not in ("utf8", "utf-8"):
+ xml.sax.parseString(menuform.getInterfaceDescription(cmd[0]).decode(enc).encode("utf-8"),
+ handler)
+ else:
+ xml.sax.parseString(menuform.getInterfaceDescription(cmd[0]),
+ handler)
+
+ return grass_task
+
+
def parseModules():
"""!Parse modules' interface"""
modules = dict()
@@ -40,7 +64,7 @@
if module in ignore:
continue
try:
- interface = menuform.GUI().ParseInterface(cmd = [module])
+ interface = ParseInterface(cmd = [module])
except IOError, e:
print >> sys.stderr, e
continue
More information about the grass-commit
mailing list