Progression
Import
from pyqgis_wrapper.utils import Progression
Progression(feedback=QgsProcessingFeedback(), mode=FeedbackType.SINGLE, steps=0)
¶
Handle the progression bar in QGIS Provided some utilities to make easier the incrementation of the progression bar and the algorithm cancellation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feedback
|
qgis.core.QgsProcessingFeedback
|
Feedback object to use for the progression bar, defaults to QgsProcessingFeedback() |
qgis.core.QgsProcessingFeedback()
|
mode
|
typing.Union[pyqgis_wrapper.utils.progression.FeedbackType, str]
|
Either a single step or multi step feedback style, defaults to FeedbackType.SINGLE Accepted : - FeedbackType.SINGLE or "SINGLE" (case insensitive) - FeedbackType.MULTI or "MULTI" (case insensitive) |
pyqgis_wrapper.utils.progression.FeedbackType.SINGLE
|
steps
|
int
|
Number of steps for the MULTi mode, defaults to 0 |
0
|
Source code in pyqgis_wrapper/utils/progression.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | |
is_canceled
property
¶
Cancel an aglorithm when the user emit a cancel signal. When catching the exception you should return an empty dict to avoid QGIS throwing an error
next_step()
¶
Increment the step for MultiStepAlgorithm Incrementation will be ignored if we already are at the maximum steps
Source code in pyqgis_wrapper/utils/progression.py
129 130 131 132 133 134 135 136 137 138 139 140 | |
set_total(total)
¶
Allows to set a total count to scale the progress bar.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
total
|
typing.Union[int, float]
|
Number of 'feature' to process tor each 100% |
required |
Source code in pyqgis_wrapper/utils/progression.py
142 143 144 145 146 147 148 149 | |
set_progress(progress, add=False, text=None)
¶
Incrementation of the progress bar
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress
|
typing.Union[int, float]
|
Value to set the progress bar at |
required |
add
|
bool
|
Add given progress to current progress if True. It'll not scale it to total if set., defaults to False |
False
|
text
|
typing.Optional[str]
|
Additionnal information for the user, defaults to None |
None
|
Source code in pyqgis_wrapper/utils/progression.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
FeedbackType
¶
Bases: str, enum.Enum
Class to store feedback mode
CancelException
¶
Bases: Exception
Raised when the cancel button is trigger. It is emant to be catched by the main loop to safely exit the algorithm