actions

The actions module provides action list classes used by the shortcuts system.

class openlp.core.utils.actions.ActionCategory(name, weight=0)[source]

Bases: builtins.object

The ActionCategory class encapsulates a category for the CategoryList class.

class openlp.core.utils.actions.ActionList[source]

Bases: builtins.object

The ActionList class contains a list of menu actions and categories associated with those actions. Each category also has a weight by which it is sorted when iterating through the list of actions or categories.

add_action(action, category=None, weight=None)[source]

Add an action to the list of actions.

Note: The action’s objectName must be set when you want to add it!

Parameters:
  • action – The action to add (QAction). Note, the action must not have an empty objectName.
  • category – The category this action belongs to. The category has to be a python string. . Note, if the category is None, the category and its actions are being hidden in the shortcut dialog. However, if they are added, it is possible to avoid assigning shortcuts twice, which is important.
  • weight – The weight specifies how important a category is. However, this only has an impact on the order the categories are displayed.
add_category(name, weight)[source]

Add an empty category to the list of categories. This is only convenient for categories with a given weight.

Parameters:
  • name – The category’s name.
  • weight – The category’s weight (int).
get_all_child_objects(qobject)[source]

Goes recursively through the children of qobject and returns a list of all child objects.

static get_instance()[source]

Get the instance of this class.

instance = None
remove_action(action, category=None)[source]

This removes an action from its category. Empty categories are automatically removed.

Parameters:
  • action – The QAction object to be removed.
  • category – The name (unicode string) of the category, which contains the action. Defaults to None.
shortcut_map = {}
update_shortcut_map(action, old_shortcuts)[source]

Remove the action for the given old_shortcuts from the shortcut_map to ensure its up-to-dateness. Note: The new action’s shortcuts must be assigned to the given action before calling this method.

Parameters:
  • action – The action whose shortcuts are supposed to be updated in the shortcut_map.
  • old_shortcuts – A list of unicode key sequences.
class openlp.core.utils.actions.CategoryActionList[source]

Bases: builtins.object

The CategoryActionList class provides a sorted list of actions within a category.

add(action, weight=0)[source]

Add an action.

append(action)[source]

Append an action

remove(action)[source]

Remove an action

class openlp.core.utils.actions.CategoryList[source]

Bases: builtins.object

The CategoryList class encapsulates a category list for the ActionList class and provides an iterator interface for walking through the list of actions in this category.

add(name, weight=0, actions=None)[source]

Add a category

append(name, actions=None)[source]

Append a category

remove(name)[source]

Remove a category

class openlp.core.utils.actions.CategoryOrder[source]

Bases: builtins.object

An enumeration class for category weights.

standard_menu = -20
standard_toolbar = -10