7. User menus. Module action¶
The action module allows to add user-defined menu items into the application. New custom menu items can be added to the following elements of the interface:
- Main menu
- Task-specific context menu
- Message-specific context menu
- Attachment-specific context menu
Note
the task-specific context menu can be called in several contexts: in Navigator, in To-Do list, in Followed list, as well as in the Search tab. Custom menu items added into the task-specific menu appear in all of listed above contexts.
The attachment-specific context menu can be called in Forum alongside with the message-specific menu, and while searching the attachments. Custom menu items added into the attachment-specific menu appear in Forum and in attachment search window.
Message-specific context menu is called from a task Forum thread.
Each menu item added should be tied to a function of a custom user’s module. Activation of the menu item calls the corresponding function. Besides, the custom user’s menu items can have graphic thumbnails and assigned hot key combinations.
Custom user’s menus are added to the init_actions functions from menu module.
-
action.
init_actions
()[source]¶ Called on application start and on Python modules updating on debugging.
action.py:
def init_actions(): ...
7.1. Adding user menus¶
Implementation of user menus is made through menu objects, described in the action module of Cerebro package. The access to these objects is gained through the actions module functions:
cerebro.actions.Action
- the base action classcerebro.actions.Actions
- the base menu classcerebro.actions.AttachmentEditorMenu
- an Attachment-specific Context menu in the editorcerebro.actions.AttachmentForumMenu
- an Attachment-specific Context menu in the forumcerebro.actions.AttachmentForumToolBar
- an Attachment-specific tool bar in the forumcerebro.actions.AttachmentSearchMenu
- an Attachment-specific Context menu in the Searchcerebro.actions.AttachmentSearchToolBar
- an Attachment-specific tool bar in the Searchcerebro.actions.MainMenu
- an application Main Menucerebro.actions.MessageForumMenu
- a Message-specific Context menu in the forumcerebro.actions.MessageForumToolBar
- a Message-specific tool bar in the forumcerebro.actions.TaskActiveMenu
- a Task-specific Context menucerebro.actions.TaskNavigatorMenu
- a Task-specific Context menu in the Navigatorcerebro.actions.TaskSearchMenu
- a Task-specific Context menu in the Searchcerebro.actions.TaskToDoListMenu
- a Task-specific Context menu in the To Do Listcerebro.actions.TaskToolBar
- a Task-specific tool bar
Using these classes one can implement user menus and actions in context menus:
On the tool bars:
In the application Main Menu:
You can find the examples of adding user’s menus here.