Class: QgsAction¶
-
class
qgis.core.
QgsAction
¶ Bases:
sip.wrapper
Default constructor
QgsAction(type: QgsAction.ActionType, description: str, command: str, capture: bool = False) Create a new QgsAction
- Parameters
type – The type of this action
description – A human readable description string
command – The action text. Its interpretation depends on the type
capture – If this is set to true, the output will be captured when an action is run
enabledOnlyWhenEditable – if true then action is only enable in editmode
QgsAction(type: QgsAction.ActionType, description: str, action: str, icon: str, capture: bool, shortTitle: str = ‘’, actionScopes: Iterable[str] = set(), notificationMessage: str = ‘’) Create a new QgsAction
- Parameters
type – The type of this action
description – A human readable description string
action – The action text. Its interpretation depends on the type
icon – Path to an icon for this action
capture – If this is set to true, the output will be captured when an action is run
shortTitle – A short string used to label user interface elements like buttons
actionScopes – A set of scopes in which this action will be available
notificationMessage – A particular message which reception will trigger the action
enabledOnlyWhenEditable – if true then action is only enable in editmode
QgsAction(QgsAction)
Utility class that encapsulates an action based on vector attributes.
Enums
Methods
The action scopes define where an action will be available.
Whether to capture output for display when this action is run
Returns the command that is executed by this action.
Returns an expression context scope used for running the action.
The icon
The path to the icon
Returns a unique id for this action.
Returns whether only enabled in editable mode
Returns true if this action was a default constructed one.
The name of the action.
Returns the notification message that triggers the action
Reads an XML definition from actionNode into this object.
Run this action.
Checks if the action is runable on the current platform
The action scopes define where an action will be available.
Sets an expression context scope to use for running the action.
The short title is used to label user interface elements like buttons
The action type
Appends an XML definition for this action as a new child node to actionsNode.
Signals
Attributes
-
class
ActionType
¶ Bases:
int
-
Generic
= 0¶
-
GenericPython
= 1¶
-
Mac
= 2¶
-
OpenUrl
= 5¶
-
Unix
= 4¶
-
Windows
= 3¶
-
actionScopes
(self) → Set[str]¶ The action scopes define where an action will be available. Action scopes may offer additional variables like the clicked coordinate.
See also
New in version 3.0.
-
capture
(self) → bool¶ Whether to capture output for display when this action is run
-
command
(self) → str¶ Returns the command that is executed by this action. How the content is interpreted depends on the type() and the actionScope().
New in version 3.0.
-
expressionContextScope
(self) → QgsExpressionContextScope¶ Returns an expression context scope used for running the action.
New in version 3.0.
-
icon
(self) → QIcon¶ The icon
-
iconPath
(self) → str¶ The path to the icon
-
id
(self) → QUuid¶ Returns a unique id for this action.
New in version 3.0.
-
isEnabledOnlyWhenEditable
(self) → bool¶ Returns whether only enabled in editable mode
-
isValid
(self) → bool¶ Returns true if this action was a default constructed one.
New in version 3.0.
-
name
(self) → str¶ The name of the action. This may be a longer description.
-
notificationMessage
(self) → str¶ Returns the notification message that triggers the action
New in version 3.0.
-
readXml
(self, actionNode: QDomNode)¶ Reads an XML definition from actionNode into this object.
New in version 3.0.
-
run
(self, layer: QgsVectorLayer, feature: QgsFeature, expressionContext: QgsExpressionContext)¶ Run this action.
New in version 3.0.
run(self, expressionContext: QgsExpressionContext) Run this action.
New in version 3.0.
-
runable
(self) → bool¶ Checks if the action is runable on the current platform
-
setActionScopes
(self, actionScopes: Iterable[str])¶ The action scopes define where an action will be available. Action scopes may offer additional variables like the clicked coordinate.
New in version 3.0.
-
setExpressionContextScope
(self, scope: QgsExpressionContextScope)¶ Sets an expression context scope to use for running the action.
New in version 3.0.
-
shortTitle
(self) → str¶ The short title is used to label user interface elements like buttons
-
type
(self) → QgsAction.ActionType¶ The action type
-
writeXml
(self, actionsNode: QDomNode)¶ Appends an XML definition for this action as a new child node to actionsNode.
New in version 3.0.