Settings File¶
The BcdaMenu GUI is configured by the content provided in a settings file which name is specified on the command line when starting the program. For example, this Linux command:
bcdamenu path/to/menus_settings.ini &
Version “2017.3.0” format of the Settings file¶
The settings file version 2017.3.0 uses the .ini format, a structure similar to what you would find in Microsoft Windows INI files. This format was chosen for its minimal approach to language markup. The examples provided should guide you to the syntax. For more details, see the documentation for the Python ConfigParser. The web has many explanations of this informal format.
Settings file elements¶
The settings file consists of sections which are lines starting with “[” and ending with “]”, such as [section_name]. In BcdaMenu, these sections are single words with no embedded white space.
Within a section, one or more lines are given with the syntax of key = value (or key: value). It is expected by the .ini format that any key is unique within its section. In BcdaMenu, the key has two parts. First an integer is given that is used to sort the menu’s items in order`. The integer is not required to be strictly increasing from 1. Gaps and negative numbers are also allowed. Keep the integers between -9999 .. 9999 to avoid any potential misunderstandings. You will not have that many menu items.
Refer to the Example settings file section for an example settings file. As the examples show, both key and value are quite flexible strings. A key should not contain either the “:” or “=” separator characters. The comment characters allowed by the .ini format should also be avoided within either key or value content.
{BcdaMenu] section: | |||||||
---|---|---|---|---|---|---|---|
This section expects the following keys and values. Other keys and values will be ignored.
|
|||||||
menu sections: | As referenced by menus or submenu keys. Each menu section must have a one-word name with no internal white space (to simplify the parsing of names in the [BcdaMenu] section. All menu (and submenu) sections must be unique with the settings file. If the same name is used in more than one section, a configparser.DuplicateSectionError exception will be raised. |
||||||
other sections: | will be ignored |
Shortcut keys¶
Shortcut keys are not supported for any menu items.
Example Settings File¶
The settings file in the source code distribution
(download
,
also shown below)
is an example demonstrating the various
features used by BcdaMenu.
file¶
The example settings file (highlighted lines show the sections, lines 1, 6, & 19 and the specification of the popup menus, line 4) is shown next.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | [BcdaMenu]
title = BcdaMenu: 9-ID-C USAXS
version = 2017.3.0
menus = USAXS linux
[USAXS]
title = 9-ID-C USAXS
1 SAXS Imaging tool = /APSshare/epd/rh6-x86/bin/python /home/beams/USAXS/Apps/USAXS_dataworker/Main.py
2 sample and detector XY position tool = wxmtxy.csh
3 separator =
4 USAXS Q calculator = qToolUsaxs.csh
5 9-ID-C USAXS controls (MEDM) = start_epics
6 Save Instr. status to Elog = saveToElog.csh
7 PyMca = /APSshare/bin/pymca
8 USAXS sample stage tool = /home/beams/USAXS/Apps/wxmtusaxs/wxmtusaxs
9 separator =
10 submenu = example_submenu
[linux]
1 Xload = xload
2 FireFox = firefox
[example_submenu]
title = this is an example of a submenu
1 comment = echo "this is not a comment"
# this is a comment
|
screens¶
This settings file produces a GUI titled 9-ID-C USAXS menu with two user menus: USAXS and linux. The following screen views are from Linux.
This is the USAXS menu:
This is the linux menu: