module StdMenus

The StdMenus submodule provides facilities for creating menu bars containing standard menus and menu commands arranged according to platform conventions. The menus can be customised in a variety of ways: items can be included or excluded individually or by functional group, and the titles and keyboard equivalents of selected items can be overridden.

Standard menu items

The standard menu commands  and their associated command names are as follows:

Typical menu text

Internal command name

General commands

About app_name

about_cmd
Help help_cmd
Preferences...

preferences_cmd
Quit

quit_cmd

File commands

New

new_cmd
Open...

open_cmd
Close

close_cmd
Save

save_cmd
Save As...

save_as_cmd
Revert

revert_cmd

Editing commands

Undo

undo_cmd
Redo

redo_cmd
Cut

cut_cmd
Copy

copy_cmd
Paste

paste_cmd
Clear

clear_cmd
Select All

select_all_cmd

Command Groups

To facilitate including or excluding groups of related commands, the StdMenus module provides the following predefined command sets that can be used to build values for the include and exclude parameters of the basic_menus() function.

Group Commands included
fundamental_cmds quit_cmd
May also include platfom-specific commands that are common to all applications.
file_cmds new_cmd, open_cmd, close_cmd, save_cmd, save_as_cmd, revert_cmd
print_cmds page_setup_cmd, print_cmd
pref_cmds preferences_cmd
help_cmds about_cmd, help_cmd

Functions

basic_menus(include = None, exclude = None, substitutions = {})
Returns a MenuList containing selected framework-defined menu commands, arranged and named according to platform conventions. It is recommended that you use this as a starting point for defining your own menu bars.

The include and exclude parameters determine which of the standard menu items are included. Each of them can take either a single command name or a sequence or set of command names. The menu bar returned will include all of the standard menu items whose command names are in include and not in exclude.

If include is not specified, it defaults to all of the standard commands.
The fundamental_cmds and edit_cmds are always included unless you explicitly exclude them via the exclude parameter.

The substitutions parameter can be used to override the titles and/or keyboard equivalents of selected menu items. It takes a mapping from command names to replacement menu item strings as accepted by the Menu() constructor. Each item string may contain a replacement title, a replacement keyboard equivalent, or both, with standard values being used for the unspecified parts.

Variables

fundamental_cmds
file_cmds
print_cmds
pref_cmds
help_cmds
Predefined CommandSet instances containing groups of standard command names.
---