mcsas.gui.bases.mixins.contextmenuwidget module¶
-
class
ContextMenuWidget[source]¶ Bases:
objectMenu states are mutual exclusive states of available context menu actions.
Menu states map to boolean methods of this object. The names of a state equal names of methods of this object otherwise the menu state is useless. updateMenu() tests the states, i.e. boolean methods for a true return value. The first one specifies the menu to be build. If none matches, the ‘default’ state will be used.
Menu states are defined by updateMenuState(). The provided list of entry names has to be a partial set of those returned by menuEntries(). Entries may be defined by addMenuEntry().
TODO: Instead of multiple inheritance, convert it to a standalone object. Problems: need to store bound methods as callbacks, to get state on update() The widget this menu applies to needs to be stored only once at init.
-
action(name)[source]¶ Warning
method ‘gui.bases.mixins.contextmenuwidget.ContextMenuWidget.action’ undocumented
-
addMenuEntry(name=None, text=None, toolTip=None, shortCut=None, checkable=False, checked=False, callbacks=None, menuStates=None)[source]¶ Argument ‘callbacks’ is supposed to be a list of methods which will be connected to the QAction.triggered signal.
-
addMenuEntryAction(name, action, menuStates=None)[source]¶ Common menu states: default and all. ‘all’ includes the default state. Everything else expects a method of the same name which evaluates to True or False. It is used to show or hide the respective context menu action. Actions bound to the same state appear grouped in the menu. The underlying ordered dict preserves the order of states.
-
addMenuSeparator(menuStates=None)[source]¶ Warning
method ‘gui.bases.mixins.contextmenuwidget.ContextMenuWidget.addMenuSeparator’ undocumented
-
addToMenuState(stateName, *entryNames)[source]¶ Warning
method ‘gui.bases.mixins.contextmenuwidget.ContextMenuWidget.addToMenuState’ undocumented
-
allMenuStates= '*'¶
-
menuEntries(stateName)[source]¶ Warning
method ‘gui.bases.mixins.contextmenuwidget.ContextMenuWidget.menuEntries’ undocumented
-