[GRASS-SVN] r40400 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 12 16:43:42 EST 2010


Author: glynn
Date: 2010-01-12 16:43:41 -0500 (Tue, 12 Jan 2010)
New Revision: 40400

Modified:
   grass/trunk/gui/wxpython/gui_modules/menudata.py
Log:
Allow explicit path to menudata.xml
Add "dump" action


Modified: grass/trunk/gui/wxpython/gui_modules/menudata.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menudata.py	2010-01-12 21:41:31 UTC (rev 40399)
+++ grass/trunk/gui/wxpython/gui_modules/menudata.py	2010-01-12 21:43:41 UTC (rev 40400)
@@ -30,6 +30,7 @@
 
 import os
 import sys
+import pprint
 try:
     import xml.etree.ElementTree as etree
 except ImportError:
@@ -37,10 +38,10 @@
 
 class Data:
     '''!Data object that returns menu descriptions to be used in wxgui.py.'''
-    def __init__(self, gisbase=None):
-        if not gisbase:
+    def __init__(self, filename=None):
+        if not filename:
             gisbase = os.getenv('GISBASE')
-	filename = os.path.join(gisbase, 'etc', 'wxpython', 'xml', 'menudata.xml')
+	    filename = os.path.join(gisbase, 'etc', 'wxpython', 'xml', 'menudata.xml')
 	self.tree = etree.parse(filename)
 
     def getMenuItem(self, mi):
@@ -159,7 +160,7 @@
                     fh.write(menuSep.join(menuItems))
                     fh.write('%s%s' % (menuSep, eachItem[0]))
                     fh.write('\n')
-        
+
     def GetModules(self):
         """!Create dictionary of modules used to search module by
         keywords, description, etc."""
@@ -212,5 +213,7 @@
         data.PrintTree(sys.stdout)
     elif action == 'commands':
         data.PrintCommands(sys.stdout)
+    elif action == 'dump':
+	pprint.pprint(data.GetMenu(), stream = sys.stdout, indent = 2)
     
     sys.exit(0)



More information about the grass-commit mailing list