Subgroup: Task
Class: QgsTaskManager¶
-
class
qgis.core.
QgsTaskManager
¶ Bases:
PyQt5.QtCore.QObject
Task manager for managing a set of long-running QgsTask tasks. This class can be created directly, or accessed via
QgsApplication.taskManager()
New in version 3.0: Methods
activeTasks
Returns a list of the active (queued or running) tasks. addTask
Adds a task to the manager. blockSignals
cancelAll
Instructs all tasks tracked by the manager to terminate. childEvent
children
connectNotify
count
Returns the number of tasks tracked by the manager. countActiveTasks
Returns the number of active (queued or running) tasks. customEvent
deleteLater
dependenciesSatisfied
Returns true if all dependencies for the specified task are satisfied dependentLayers
Returns a list of layers on which as task is dependent. disconnect
disconnectNotify
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
killTimer
metaObject
moveToThread
objectName
parent
property
pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. receivers
removeEventFilter
sender
senderSignalIndex
setObjectName
setParent
setProperty
signalsBlocked
startTimer
task
Returns the task with matching ID. taskId
Returns the unique task ID corresponding to a task managed by the class. tasks
Returns all tasks tracked by the manager. tasksDependentOnLayer
Returns a list of tasks which depend on a layer. thread
timerEvent
tr
Attributes
allTasksFinished
Emitted when all tasks are complete countActiveTasksChanged
Emitted when the number of active tasks changes destroyed
destroyed(self, QObject = None) [signal] finalTaskProgressChanged
Will be emitted when only a single task remains to complete objectNameChanged
objectNameChanged(self, str) [signal] progressChanged
Will be emitted when a task reports a progress change staticMetaObject
statusChanged
Will be emitted when a task reports a status change taskAboutToBeDeleted
Emitted when a task is about to be deleted taskAdded
Emitted when a new task has been added to the manager -
class
TaskDefinition
(task: QgsTask, dependentTasks: object = QgsTaskList())¶ Bases:
sip.wrapper
Constructor for TaskDefinition. Ownership of the task is not transferred to the definition, but will be transferred to a QgsTaskManager.
QgsTaskManager.TaskDefinition(QgsTaskManager.TaskDefinition)
-
dependentTasks
¶
-
task
¶
-
-
activeTasks
(self) → List[QgsTask]¶ Returns a list of the active (queued or running) tasks.
See also
-
addTask
(self, task: QgsTask, priority: int = 0) → int¶ Adds a task to the manager. Ownership of the task is transferred to the manager, and the task manager will be responsible for starting the task. The priority argument can be used to control the run queue’s order of execution, with larger numbers taking precedence over lower priority numbers.
Returns: unique task ID addTask(self, task: QgsTaskManager.TaskDefinition, priority: int = 0) -> int Adds a task to the manager, using a full task definition (including dependency handling). Ownership of the task is transferred to the manager, and the task manager will be responsible for starting the task. The priority argument can be used to control the run queue’s order of execution, with larger numbers taking precedence over lower priority numbers.
Returns: unique task ID
-
allTasksFinished
¶ Emitted when all tasks are complete
See also
countActiveTasksChanged()
[signal]
-
cancelAll
(self)¶ Instructs all tasks tracked by the manager to terminate. Individual tasks may take some time to cancel, or may totally ignore this instruction. Calling this does not block but will instead signal the tasks to cancel and then return immediately.
-
childEvent
()¶
-
connectNotify
()¶
-
count
(self) → int¶ Returns the number of tasks tracked by the manager.
-
countActiveTasks
(self) → int¶ Returns the number of active (queued or running) tasks.
See also
See also
-
countActiveTasksChanged
¶ Emitted when the number of active tasks changes
See also
countActiveTasks()
[signal]
-
customEvent
()¶
-
dependenciesSatisfied
(self, taskId: int) → bool¶ Returns true if all dependencies for the specified task are satisfied
-
dependentLayers
(self, taskId: int) → List[QgsMapLayer]¶ Returns a list of layers on which as task is dependent. The task will automatically be canceled if any of these layers are above to be removed.
Parameters: taskId – task ID Returns: list of layers See also
-
disconnectNotify
()¶
-
finalTaskProgressChanged
¶ Will be emitted when only a single task remains to complete and that task has reported a progress change
Parameters: progress – percent of progress, from 0.0 - 100.0 [signal]
-
isSignalConnected
()¶
-
progressChanged
¶ Will be emitted when a task reports a progress change
Parameters: - taskId – ID of task
- progress – percent of progress, from 0.0 - 100.0 [signal]
-
receivers
()¶
-
sender
()¶
-
senderSignalIndex
()¶
-
statusChanged
¶ Will be emitted when a task reports a status change
Parameters: - taskId – ID of task
- status – new task status [signal]
-
task
(self, id: int) → QgsTask¶ Returns the task with matching ID.
Parameters: id – task ID Returns: task if found, or None
-
taskAboutToBeDeleted
¶ Emitted when a task is about to be deleted
Parameters: taskId – ID of task [signal]
-
taskAdded
¶ Emitted when a new task has been added to the manager
Parameters: taskId – ID of task [signal]
-
taskId
(self, task: QgsTask) → int¶ Returns the unique task ID corresponding to a task managed by the class.
Parameters: task – task to find Returns: task ID, or -1 if task not found
-
tasks
(self) → List[QgsTask]¶ Returns all tasks tracked by the manager.
-
tasksDependentOnLayer
(self, layer: QgsMapLayer) → List[QgsTask]¶ Returns a list of tasks which depend on a layer.
See also
-
timerEvent
()¶
-
class