[GRASS-SVN] r49624 - grass/branches/develbranch_6/gui/wxpython/tools

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 8 08:12:21 EST 2011


Author: martinl
Date: 2011-12-08 05:12:21 -0800 (Thu, 08 Dec 2011)
New Revision: 49624

Modified:
   grass/branches/develbranch_6/gui/wxpython/tools/update_menudata.py
Log:
wxGUI: update tools after core reorganization


Modified: grass/branches/develbranch_6/gui/wxpython/tools/update_menudata.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/tools/update_menudata.py	2011-12-08 13:10:24 UTC (rev 49623)
+++ grass/branches/develbranch_6/gui/wxpython/tools/update_menudata.py	2011-12-08 13:12:21 UTC (rev 49624)
@@ -30,23 +30,24 @@
 from grass.script import core as grass
 from grass.script import task as gtask
 
-sys.path.append('gui_modules')
-import menudata
+if __name__ == "__main__":
+    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'wxpython'))
+from lmgr.menudata  import ManagerData
+from core.globalvar import grassCmd
 
 def parseModules():
     """!Parse modules' interface"""
     modules = dict()
     
     # list of modules to be ignored
-    ignore =  [ 'mkftcap',
+    ignore =  [ 'g.mapsets_picker.py',
+                'v.type_wrapper.py',
                 'g.parser',
-                'r.mapcalc',
-                'r3.mapcalc',
                 'vcolors' ]
     
-    count = len(globalvar.grassCmd['all'])
+    count = len(grassCmd['all'])
     i = 0
-    for module in globalvar.grassCmd['all']:
+    for module in grassCmd['all']:
         i += 1
         if i % 10 == 0:
             grass.info('* %d/%d' % (i, count))
@@ -54,8 +55,8 @@
             continue
         try:
             interface = gtask.parse_interface(module)
-        except IOError, e:
-            grass.error(e)
+        except StandardError, e:
+            grass.error(module + ': ' + str(e))
             continue
         modules[interface.name] = { 'label'   : interface.label,
                                     'desc'    : interface.description,
@@ -69,7 +70,7 @@
     ignore = ['v.type_wrapper.py',
               'vcolors']
     
-    menu_modules = list()    
+    menu_modules = list()
     for node in data.tree.getiterator():
         if node.tag != 'menuitem':
             continue
@@ -105,7 +106,7 @@
             node.find('keywords').text = ','.join(modules[module]['keywords'])
         
         menu_modules.append(item['command'])
-    
+
     for module in modules.keys():
         if module not in menu_modules:
             grass.warning("'%s' not available from the menu" % module)
@@ -150,7 +151,7 @@
     modules = dict()
     modules = parseModules()
     grass.info("Step 3: reading menu data...")
-    data = menudata.ManagerData()
+    data = ManagerData()
     grass.info("Step 4: updating menu data...")
     updateData(data, modules)
     
@@ -172,9 +173,4 @@
     if os.getenv("GISBASE") is None:
         sys.exit("You must be in GRASS GIS to run this program.")
     
-    sys.path.append(os.path.join(os.getenv("GISBASE"), 'etc', 'wxpython', 'gui_modules'))
-    import menudata
-    import menuform
-    import globalvar
-    
     sys.exit(main())



More information about the grass-commit mailing list