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
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.
Called on application start and on Python modules updating on debugging.
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 class
cerebro.actions.Actions- the base menu class
cerebro.actions.AttachmentEditorMenu- an Attachment-specific Context menu in the editor
cerebro.actions.AttachmentForumMenu- an Attachment-specific Context menu in the forum
cerebro.actions.AttachmentForumToolBar- an Attachment-specific tool bar in the forum
cerebro.actions.AttachmentSearchMenu- an Attachment-specific Context menu in the Search
cerebro.actions.AttachmentSearchToolBar- an Attachment-specific tool bar in the Search
cerebro.actions.MainMenu- an application Main Menu
cerebro.actions.MessageForumMenu- a Message-specific Context menu in the forum
cerebro.actions.MessageForumToolBar- a Message-specific tool bar in the forum
cerebro.actions.TaskActiveMenu- a Task-specific Context menu
cerebro.actions.TaskNavigatorMenu- a Task-specific Context menu in the Navigator
cerebro.actions.TaskSearchMenu- a Task-specific Context menu in the Search
cerebro.actions.TaskToDoListMenu- a Task-specific Context menu in the To Do List
cerebro.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.