actions¶
The actions
module provides action list classes used
by the shortcuts system.
-
class
openlp.core.common.actions.
ActionCategory
(name, weight=0)[source]¶ Bases:
object
The
ActionCategory
class encapsulates a category for theCategoryList
class.
-
class
openlp.core.common.actions.
ActionList
[source]¶ Bases:
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.
- action – The action to add (QAction). Note, the action must not have an empty
-
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.
-
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.
- action – The
-
shortcut_map
= {}¶
-
update_shortcut_map
(action, old_shortcuts)[source]¶ Remove the action for the given
old_shortcuts
from theshortcut_map
to ensure its up-to-dateness. Note: The new action’s shortcuts must be assigned to the givenaction
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.
- action – The action whose shortcuts are supposed to be updated in the
-
-
class
openlp.core.common.actions.
CategoryActionList
[source]¶ Bases:
object
The
CategoryActionList
class provides a sorted list of actions within a category.