-
Notifications
You must be signed in to change notification settings - Fork 33
Actions, Menus, Keys
Actions define most user actions in the application.
Actions are subclasses of Window.Action
which is defined in the nionui
module. An Action
consists of a action_id
, which can be used to refer to the action from a menu or key configuration file. An Action
also defines an action_name
which is the default title that is used when referring to the action from the UI, such as in a menu.
Actions are registered with the application at startup by using the function Window.register_action(action)
.
Actions implement execute
and (optionally) invoke
functions. The execute
function is intended to execute the action without user interaction. The invoke
function may have additional user interaction. The default invoke
implementation is to call execute
. For example, a "clone" action may ask for a name from the user in the invoke
method but require a name parameter in the execute
method.
The menu items are defined in menu_config.json
.
Top level menus, sub-menus, and action items are declared. Action items are referenced by action_id
and the menu item title is determined by the Action
associated with the action_id
.
The key overloads are defined in key_config.json
.
The key overloads are a mapping from action_id
to a list of key overloads.
Plug-in modules cannot yet defined their own actions/menus/keys via this mechanism. See #836.
Some keys are still handled explicitly in code rather than via actions.