6.65. umbra.managers.actionsManager

actionsManager.py

Platform:
Windows, Linux, Mac Os X.
Description:
Defines the ActionsManager class.
The ActionsManager class provides a centralized hub to manage Applications actions.
It defines methods to register, unregister and list actions.

Others:

6.65.1. Module Attributes

umbra.managers.actionsManager.LOGGER

6.65.2. Classes

class umbra.managers.actionsManager.ActionsManager(parent=None, namespaceSplitter=u'|', rootNamespace=u'Actions', defaultNamespace=u'Others')[source]

Bases: PyQt4.QtCore.QObject

Defines a QObject subclass providing an actions manager.

Initializes the class.

Parameters:
  • parent (QObject) – Object parent.
  • namespaceSplitter (unicode) – Namespace splitters character.
  • rootNamespace (unicode) – Root foundations.namespace.
  • defaultNamespace (unicode) – Default namespace ( For actions with relative path ).
namespaceSplitter[source]

Property for self.__namespaceSplitter attribute.

Returns:self.__namespaceSplitter.
Return type:unicode
rootNamespace[source]

Property for self.__rootNamespace attribute.

Returns:self.__rootNamespace.
Return type:unicode
defaultNamespace[source]

Property for self.__defaultNamespace attribute.

Returns:self.__defaultNamespace.
Return type:unicode
categories[source]

Property for self.__categories attribute.

Returns:self.__categories.
Return type:dict
get(action, default=None)[source]

Returns given action value.

Parameters:
  • action (unicode) – Action name.
  • default (object) – Default value if action is not found.
Returns:

Action.

Return type:

QAction

listActions()[source]

Returns the registered actions.

Returns:Actions list.
Return type:list
getCategory(name, vivify=False)[source]

Returns requested category.

Parameters:
  • name (unicode) – Category to retrieve.
  • vivify (bool) – Vivify missing parents in the chain to the requested category.
Returns:

Category.

Return type:

dict

addToCategory(category, name, action)[source]

Adds given action to given category.

Parameters:
  • category (unicode) – Category to store the action.
  • name (unicode) – Action name.
  • action (QAction) – Action object.
Returns:

Method success.

Return type:

bool

removeFromCategory(category, name)[source]

Removes given action from given category.

Parameters:
  • category (unicode) – Category to remove the action from.
  • name (unicode) – Action name.
Returns:

Method success.

Return type:

bool

getAction(action)[source]

Returns requested action.

Parameters:action (unicode) – Action name.
Returns:Action.
Return type:QAction
isActionRegistered(name)[source]

Returns if the given action name is registered.

Parameters:name (unicode) – Action name.
Returns:Is action registered.
Return type:bool
registerAction(name, **kwargs)[source]

Registers given action name, optional arguments like a parent, icon, slot etc ... can be given.

Parameters:
  • name (unicode) – Action to register.
  • **kwargs (**) – Keywords arguments.
Returns:

Action.

Return type:

QAction

unregisterAction(name)[source]

Unregisters given action name.

Parameters:name (unicode) – Action to register.
Returns:Method success.
Return type:bool
isShortcutInUse(shortcut)[source]

Returns if given action shortcut is in use.

Parameters:name (unicode) – Action shortcut.
Returns:Is shortcut in use.
Return type:bool
getShortcut(name)[source]

Returns given action shortcut.

Parameters:name (unicode) – Action to retrieve the shortcut.
Returns:Action shortcut.
Return type:unicode
setShortcut(name, shortcut)[source]

Sets given action shortcut.

Parameters:
  • name (unicode) – Action to set the shortcut.
  • shortcut (unicode) – Shortcut to set.
Returns:

Method success.

Return type:

bool