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:

Using these classes one can implement user menus and actions in context menus:

_images/capi_example_menu2.png

On the tool bars:

_images/capi_example_menu4.png

In the application Main Menu:

_images/capi_example_menu5.png

You can find the examples of adding user’s menus here.