GUI command used in Menus and ToolBars.
An action contains text, icons and a command callback. The action can be inserted into menus and/or toolbars. When the menu or toolbar button is clicked the action is called. Actions are used in Tool Wheel. The text displayed in the Tool Wheel is based on the text attribute which should be passed to tr() before.
Actions are modeled after Qts Action class. Refer to the Qt documentation for more information.
- property accel¶
Key sequence to activate/toggle this action, like “Ctrl+q”.
- property checkable¶
(bool) Does this action get toggled on and off?
- property checked¶
(bool) Does the action appear toggled on?
Setting value does not emit signal (command is not called).
- property command¶
Method called when the action button is clicked.
- property enabled¶
The availability of the action.
Disabled actions are grayed out and the user cannot activate them.
- property exclusive¶
The group exclusive property.
If this action is contained in a group and the group exclusive property is True, this action would toggle off when any other action in the group is toggled on.
Setting to False makes the actions toggle independently.
Setting to True simple does not do anything if the group is not set as exclusive.
- property icon¶
File name of the icon.
Local names are looked up from the paths specified in addResourcePath.
When setting the icon the value can be a tuple of (icon, position) where position is the x,y translation of the icon.
- property ison¶
Determines if the action is on or not.
Deprecated: Use ‘checked’ property and ‘toggle’ method instead.
- property name¶
Unique identifier across profiles.
This is only settable in the constructor.
- property selectable¶
The ability to select the action.
Setting to False allows for creating a background icon.
- property statustip¶
Text displayed in the status bar when the cursor is over the icon or text.
- property text¶
Text label displayed in the menu/toolbar.
- property tooltip¶
Text displayed in a popup when cursor is over the icon or text.
- property visible¶
The visibility of the action.
Setting to False will visually remove this from the menu/toolbar.
- property whatsthis¶
Text displayed when cursor is over the icon or text and user hits F1.
- classmethod get(cls, name)¶
Returns the named action from defined in active profile.
- param name
- type name
Deletes this and all its children.
Warning, make sure to remove the action from the ui before destroying or this will crash!
Calls command callback method when an Action is clicked.
- onToggle(self, on)¶
Acts when an Action is toggled.
If is coupled to dialog it will show or hide the dialog.
If is coupled to a context it will get in and out the context.
If is coupled to callback it will run the callback with state or not.
- param on
Determines whether to toggle on or off.
- type on
- toggle(self, on=None)¶
Simulate clicking the action.
- param on
Pass True/False to ensure you are toggling on or off. None flips the state.
- type on
bool | None