GSEOS allows you to define custom menus to easily access any of your commands. The command menu definitions are stored in a flat ASCII files with the .cm extension. You can specify the command menu files to load in the Load entry of the [Config] section of the gseos.ini file.
The following image shows a custom menu:
Below is a sample command menu file to demonstrate the syntax:
Menuitem &Start, fStart()
}
Include MyIncludeFile.cm
}
The command menu file recognizes the following keywords:
Menu, Popup, Menuitem, Separator, and Include.
A command menu file can have multiple main menu entries. Each main menu entry is defined with the Menu keyword followed by the menu name. In the above case &Config. The ampersand character '&' can be used to define keyboard shortcuts for the menu. The character following the ampersand character can be used to activate the command.
The Menu body as well as the Popup body is enclosed in curly braces '{', '}'. The Menu body and contain any number of Popup, Separator, and Menuitem entries. A Menuitem entry lets you specify a command to be excuted. The syntax is:
Menuitem Menu Name, Command
where the Menu Name is the name as it appears on the menu and the command is any valid command you have defined. It is possible to issue arbitrary Python commands if the ForwardToPython setting in gseos.ini is set. Make sure you use the proper namespaces. I.e. if you have your commands defined in a module called InstCmds and you import the module with import InstCmds you would need to use InstCmds.MyCommand() to issue the MyCommand() command.
A Separator places a separator between menu items. The Popup keyword allows you to set up a command hierarchy by nesting menus. You can place and number of Popup, MenuItem, and Separator keywords within the body of a Popup statement. You can nest to any level.
As with the command button definition you have a simple text preprocessor available that lets you prompt for parameters and does simple text replacement. If you have Python commands that expect strings you have to make sure to embed the parameter in quotation marks. You can do this in the menu definition so the user does not have to supply the quotation marks. See the example above.
The Include statement lets you include other command menu files. The file to be included will be inserted in place of the Include statement. The included command menu file must be itself a well-formatted command menu file. The Menu statements in the included file will be converted into Popup statements in the including file. The included file may have multiple Menu statements.