update April 3, 2010
NAME
makemenus.py - create platform-specific .GDEmenus files by concatenating files containing individual menu items. Locally-installed items are automatically merged into the .GDEmenus files. This document assumes that you are familiar with the structure of the .GDEmenus file as described in the GDE Manual.

SYNOPSIS
python makemenus.py
create .GDEmenus files for all supported platforms and write to files as described below. Use this form if GDE is being used as part of a locally-installed copy of  the BIRCH system (http://home.cc.umanitoba.ca/~psgendb)
python makemenus.py - p platform
create a .GDEmenus file for the specified platform.
python makemenus.py -h
print usage message

DESCRIPTION
makemenus.py works within the current working directory. Typically, this directory is called GDE, and assumes the following directory structure:

dat/GDE/
GDEHELP-solaris-sparc/
.GDEmenus
GDEHELP-solaris-amd64/
.GDEmenus
GDEHELP-linux-intel/
.GDEmenus
GDEHELP-linux-x86_64/
.GDEmenus
GDEHELP-osx-x86_64/
.GDEmenus
makemenus.py
makemenus/
ldir.param
menus/
menulist
<menu directories>
*.item
(At a BIRCH site, the GDE directory is $BIRCH/dat/GDE.) Within GDE/makemenus/menus, the file menulist contains menu lines and item lines. Indentation by tab characters defines the File/Menu item hierarchy. Each menu consists of a menu line followed by 0 or more item lines:

<menu>::=<menuline>[<item line>]

<menu line> ::= <menu name>
<item line> ::= <TAB><item name><TAB><platform flags>

<menu name> is the name of a GDE menu and is also the name of a directory in GDE/makemenus containing GDE menu items, each in a separate file. Blanks may be included in menu names, but are discouraged, since the menu name is also a directory name.

<item name> - Item name is the name of a GDE menu item, and is also the name of a file containing the GDE menu item. The actual file name must have the ".item" extension, but this extension must NOT be used in the menulist file. Again, blanks are permitted in item names, but are discouraged.

<platform flags> - This field consists of one or more non-blank letters indicating the platform on which a program is available. If this field is empty, the menu item will be included in .GDEmenus files for all platforms. If the field is not empty, the menu item will only be included in the specified .GDEmenus files. On a BIRCH site, when no command line arguments are used, a different .GDEmenus file is written for each supported platform.

The following letters may be included in the platform flags fields:

Platform
platform flag for menulist file
location of .GDEmenus file
solaris sparc S
GDE/GDEHELP-solaris-sparc
solaris-amd64 s GDE/GDEHELP-solaris-amd64
linux-intel L GDE/GDEHELP-linux-intel
linux-x86_64 l
GDE/GDEHELP-linux-x86_64
osx-x86_64 M
GDE/GDEHELP-osx-x86_64

At login time, the user's $GDE_HELP_DIR is set to one of these directories, so that the user gets GDE menus customized for the platform he is currently logged into.

The order of menus and  items displayed in GDE will be the same as the order in menulist.

Any line on which the first non-whitespace character is a hashmark '#', will be ignored as a comment.
BIRCH - MERGING LOCAL MENU ITEMS INTO GDE
Locally-installed programs that are not part of the official BIRCH distribution can be merged into the GDE menus. makemenus.py creates its menus in two steps. First, it reads the menulist from GDE/makemenus/menus, and then, if it exists, reads makemenus/ldir.parm, which contains the name of a local copy of the makemenus directories. On a BIRCH system, this is $BIRCH/local/dat/GDE/makemenus/menus. The structure of both of these directories and subdirectories is identical.  If a menuitem is read from $BIRCH/local with the same name as an existing item in $BIRCH, the copy in $BIRCH/local overwrites the original. This makes it possible to maintain locall-modified menuitems that replace the ones supplied with BIRCH.

SPECIAL NOTE: DNA/RNA MENU
Several menus are hardwired into GDE. That is, in  the File, Edit and DNA/RNA, there are several internal GDE functions that are not specified in the .GDEmenus file. The DNA/RNA menu contains one hardwired item, the Complement function. If we don't include a menu called DNA/RNA, this function is lost. However, it is a VERY bad idea to have a '/' character in the name of a directory. The workaround is that we call the directory DNARNA. makemenus.py will print this as 'DNA/RNA' to the .GDEmenus file, so that GDE correctly displays this menu.

EXAMPLE
A menulist file  might include:
# multiple sequence alignment
Alignment
clustalx
pima S
jalview
boxshade Ll
# phylogenetic analysis
Phylogeny
Phylip
fastDNAml
atv SLl
A user logging into a Solaris system would see all items except boxshade, while a user logging into a Linux system would see all items except pima. Note that if the platform field is blank, then the item is available on all platforms. In this example, putting both S and L in the platform field accomplishes the same thing.
(Note: All indentation must be done using TAB characters, not blanks.  Similarly, the platform fields are separated from the item-name fields by TABs.)

In the example, within GDE/makemenus, there must be directories called Alignment and Phylogeny. Alignment would contain clustalx.item, pima.item, jalview.item and boxshade.item. Phylogeny would contain Phylip.item, fastDNAml.item and atv.item.

Locally-installed programs can be integrated into the .GDEmenus files. For example, if $BIRCH/local/cat/GDE/makemenus/menulist contained
Alignment
reform
and there was a file called Alignment/reform.item, then the reform program would be added to the bottom of the Alignment menu.
FILES
GDE/makemenus.py
makemenus/menus/menulist
$BIRCH/local/dat/GDE/makemenus/menus/menulist
BUGS
 If none of the files listed in a menu are available for a given platform, the .GDEmenus file for that platform will generate an empty menu.
AUTHOR
Dr. Brian Fristensky
Department of Plant Science
University of Manitoba
Winnipeg, MB  Canada R3T 2N2
frist@cc.umanitoba.ca
http://home.cc.umanitoba.ca/~frist