[GRASS-SVN] r37812 - in grass/branches/develbranch_6: gui/wxpython/support gui/wxpython/xml raster/r.support.stats raster/r.terraflow raster/r.water.outlet

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 10 16:38:43 EDT 2009


Author: martinl
Date: 2009-06-10 16:38:43 -0400 (Wed, 10 Jun 2009)
New Revision: 37812

Modified:
   grass/branches/develbranch_6/gui/wxpython/support/update_menudata.py
   grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
   grass/branches/develbranch_6/raster/r.support.stats/main.c
   grass/branches/develbranch_6/raster/r.terraflow/main.cc
   grass/branches/develbranch_6/raster/r.water.outlet/main.c
Log:
Add missing keywords
Update menu (remove disabled modules)
       (merge from trunk, r37809, r37810, r37811)


Modified: grass/branches/develbranch_6/gui/wxpython/support/update_menudata.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/support/update_menudata.py	2009-06-10 20:19:06 UTC (rev 37811)
+++ grass/branches/develbranch_6/gui/wxpython/support/update_menudata.py	2009-06-10 20:38:43 UTC (rev 37812)
@@ -58,16 +58,24 @@
 
 def updateData(data, modules):
     """!Update menu data tree"""
+    # list of modules to be ignored
+    ignore =  [ 'v.type_wrapper.py',
+                'vcolors' ]
+    
+
     for node in data.tree.getiterator():
         if node.tag != 'menuitem':
             continue
-        
+
         item = dict()
         for child in node.getchildren():
             item[child.tag] = child.text
         
         if not item.has_key('command'):
             continue
+
+        if item['command'] in ignore:
+            continue
         
         module = item['command'].split(' ')[0]
         if not modules.has_key(module):
@@ -79,15 +87,23 @@
         else:
             desc = modules[module]['desc']
         node.find('help').text = desc
-        if node.find('keywords') is not None:
+
+        if not modules[module].has_key('keywords'):
+            grass.warning('%s: keywords missing' % module)
+        else:
+            if node.find('keywords') is None:
+                node.insert(2, etree.Element('keywords'))
+                grass.warning("Adding tag 'keywords' to '%s'" % module)
             node.find('keywords').text = ','.join(modules[module]['keywords'])
-        else:
-            grass.warning('%s: keywords missing' % module)
         
 def writeData(data):
     """!Write updated menudata.xml"""
     file = os.path.join('..', 'xml', 'menudata.xml')
-    data.tree.write(file)
+    try:
+        data.tree.write(file)
+    except IOError:
+        print >> sys.stderr, "'menudata.xml' not found. Please run the script from 'gui/wxpython/support'."
+        
 
 def main(argv = None):
     if argv is None:
@@ -114,7 +130,7 @@
         print >> sys.stderr, "You must be in GRASS GIS to run this program."
         sys.exit(1)
     
-    sys.path.append('../gui_modules')
+    sys.path.append(os.path.join(os.getenv("GISBASE"), 'etc', 'wxpython', 'gui_modules'))
     import menudata
     import menuform
     import globalvar

Modified: grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml	2009-06-10 20:19:06 UTC (rev 37811)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml	2009-06-10 20:38:43 UTC (rev 37812)
@@ -591,7 +591,8 @@
 	<separator />
 	<menuitem>
 	  <label>NVIZ (requires Tcl/Tk)</label>
-	  <help>nviz - Visualization and animation tool for GRASS data</help>
+	  <help>nviz - Visualization and animation tool for GRASS data.</help>
+	  <keywords>raster,vector,visualization</keywords>
 	  <handler>self.OnMenuCmd</handler>
 	  <command>nviz</command>
 	</menuitem>
@@ -817,6 +818,7 @@
 	    <menuitem>
 	      <label>Update map statistics</label>
 	      <help>Update raster map statistics</help>
+	      <keywords>raster,statistics</keywords>
 	      <handler>self.OnMenuCmd</handler>
 	      <command>r.support.stats</command>
 	    </menuitem>
@@ -1133,6 +1135,7 @@
 	    <menuitem>
 	      <label>Flow accumulation</label>
 	      <help>Flow computation for massive grids (Float version).</help>
+	      <keywords>raster</keywords>
 	      <handler>self.OnMenuCmd</handler>
 	      <command>r.terraflow</command>
 	    </menuitem>
@@ -1191,6 +1194,7 @@
 	    <menuitem>
 	      <label>Watershed basin creation</label>
 	      <help>Watershed basin creation program.</help>
+	      <keywords>raster</keywords>
 	      <handler>self.OnMenuCmd</handler>
 	      <command>r.water.outlet</command>
 	    </menuitem>

Modified: grass/branches/develbranch_6/raster/r.support.stats/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.support.stats/main.c	2009-06-10 20:19:06 UTC (rev 37811)
+++ grass/branches/develbranch_6/raster/r.support.stats/main.c	2009-06-10 20:38:43 UTC (rev 37812)
@@ -36,6 +36,7 @@
 
     module = G_define_module();
     module->description = _("Update raster map statistics");
+    module->keywords = _("raster, statistics");
 
     parm.raster = G_define_standard_option(G_OPT_R_MAP);
 

Modified: grass/branches/develbranch_6/raster/r.terraflow/main.cc
===================================================================
--- grass/branches/develbranch_6/raster/r.terraflow/main.cc	2009-06-10 20:19:06 UTC (rev 37811)
+++ grass/branches/develbranch_6/raster/r.terraflow/main.cc	2009-06-10 20:38:43 UTC (rev 37812)
@@ -471,6 +471,7 @@
 #ifdef ELEV_FLOAT
   module->description = _("Flow computation for massive grids (Float version).");
 #endif
+  module->keywords = _("raster");
 
   /* read user options; fill in global <opt> */
   opt = (userOptions*)malloc(sizeof(userOptions));

Modified: grass/branches/develbranch_6/raster/r.water.outlet/main.c
===================================================================
--- grass/branches/develbranch_6/raster/r.water.outlet/main.c	2009-06-10 20:19:06 UTC (rev 37811)
+++ grass/branches/develbranch_6/raster/r.water.outlet/main.c	2009-06-10 20:38:43 UTC (rev 37812)
@@ -45,7 +45,8 @@
 
     module = G_define_module();
     module->description = _("Watershed basin creation program.");
-
+    module->keywords = _("raster");
+    
     opt1 = G_define_option();
     opt1->key = "drainage";
     opt1->type = TYPE_STRING;
@@ -127,7 +128,7 @@
     for (row = 0; row < nrows; row++) {
 	G_get_map_row(drain_fd, cell_buf, row);
 	for (col = 0; col < ncols; col++) {
-	    if (cell_buf[col] == 0)
+	    if (cell_buf[col] == 0) 
 		total--;
 	    drain_ptrs[SEG_INDEX(pt_seg, row, col)] = cell_buf[col];
 	}



More information about the grass-commit mailing list