Skip to content

Commit 94300ea

Browse files
nirvnnyalldawson
authored andcommitted
Add proxy progress task for non-background algorithms
1 parent 5d078ec commit 94300ea

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/plugins/processing/gui/AlgorithmDialog.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
QgsProcessingOutputLayerDefinition,
4444
QgsProcessingParameterFeatureSink,
4545
QgsProcessingParameterRasterDestination,
46-
QgsProcessingAlgorithm)
46+
QgsProcessingAlgorithm,
47+
QgsProxyProgressTask,
48+
QgsTaskManager)
4749
from qgis.gui import (QgsGui,
4850
QgsMessageBar,
4951
QgsProcessingAlgorithmDialogBase)
@@ -219,9 +221,14 @@ def on_complete(ok, results):
219221
task.executed.connect(on_complete)
220222
self.setCurrentTask(task)
221223
else:
224+
self.proxy_progress = QgsProxyProgressTask(self.tr("Executing “{}”").format(self.algorithm().displayName()))
225+
QgsApplication.taskManager().addTask(self.proxy_progress)
226+
feedback.progressChanged.connect(self.proxy_progress.setProxyProgress)
222227
self.feedback_dialog = self.createProgressDialog()
223228
self.feedback_dialog.show()
224229
ok, results = execute(self.algorithm(), parameters, context, feedback)
230+
feedback.progressChanged.disconnect()
231+
self.proxy_progress.finalize(ok)
225232
on_complete(ok, results)
226233

227234
except AlgorithmDialogBase.InvalidParameterValue as e:

0 commit comments

Comments
 (0)