[GRASS-SVN] r36038 - grass/branches/develbranch_6/tools
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Feb 22 07:30:07 EST 2009
Author: hamish
Date: 2009-02-22 07:30:07 -0500 (Sun, 22 Feb 2009)
New Revision: 36038
Modified:
grass/branches/develbranch_6/tools/module_synopsis.sh
Log:
crude attempt at building menu hierarchy
Modified: grass/branches/develbranch_6/tools/module_synopsis.sh
===================================================================
--- grass/branches/develbranch_6/tools/module_synopsis.sh 2009-02-22 12:18:23 UTC (rev 36037)
+++ grass/branches/develbranch_6/tools/module_synopsis.sh 2009-02-22 12:30:07 UTC (rev 36038)
@@ -55,7 +55,41 @@
OLDDIR="`pwd`"
cd "$GISBASE"
+XML_MENU="$GISBASE/etc/wxpython/xml/menudata.xml"
+
+# work in progress -- still rather buggy.
+find_menu_hierarchy()
+{
+unset MODULE_COUNT MODULE_LABEL MODULE_MENU1 MODULE_MENU2
+
+MODULE_COUNT=`grep -c -w "$MODULE" "$XML_MENU"`
+
+if [ "$MODULE_COUNT" -ge 1 ] ; then
+ MODULE_LABEL=`xml2 < "$XML_MENU" | grep -w -B5 "$MODULE" | \
+ grep 'label=' | cut -f2 -d= | tr '\n' '>' | \
+ sed -e 's/>$//' -e 's/[^ ]>/ > /'`
+
+ MODULE_MENU1=`xml2 < "$XML_MENU" | grep -w -B5000 "$MODULE" | \
+ sed -e 's+^/menudata/menubar/menu/++' | tac | \
+ grep '/label=\|^label=' | grep -B1000 '^label=' -m 1 | \
+ grep -v menuitem | tail -n 1 | cut -f2 -d=`
+
+ MODULE_MENU2=`xml2 < "$XML_MENU" | grep -w -B5000 "$MODULE" | \
+ sed -e 's+^/menudata/menubar/menu/++' | tac | \
+ grep '/label=\|^label=' | grep -B1000 '^label=' -m 1 | \
+ grep -v menuitem | head -n 1 | cut -f2 -d= | tr '\n' ' ' | \
+ sed -e 's/ $//'`
+
+ if [ "$MODULE_COUNT" -eq 1 ] ; then
+ echo "$MODULE|$MODULE_MENU1 > $MODULE_MENU2 > $MODULE_LABEL"
+ else
+ # "*" indicates module appears more than once
+ echo "$MODULE*|$MODULE_MENU1 > $MODULE_MENU2 > $MODULE_LABEL"
+ fi
+fi
+}
+
for DIR in bin scripts ; do
cd $DIR
@@ -70,6 +104,8 @@
;;
esac
+# find_menu_hierarchy
+
eval `$MODULE --tcltk | head -n 3 | tail -n 2 | tr '"' "'" | \
sed -e 's/^ //' -e 's/ {/="/' -e 's/}$/"/'`
if [ -z "$label" ] && [ -z "$desc" ] ; then
More information about the grass-commit
mailing list