Skip to content

Commit

Permalink
Add proxy progress task for non-background algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored and nyalldawson committed Aug 15, 2018
1 parent 5d078ec commit 94300ea
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/plugins/processing/gui/AlgorithmDialog.py
Expand Up @@ -43,7 +43,9 @@
QgsProcessingOutputLayerDefinition,
QgsProcessingParameterFeatureSink,
QgsProcessingParameterRasterDestination,
QgsProcessingAlgorithm)
QgsProcessingAlgorithm,
QgsProxyProgressTask,
QgsTaskManager)
from qgis.gui import (QgsGui,
QgsMessageBar,
QgsProcessingAlgorithmDialogBase)
Expand Down Expand Up @@ -219,9 +221,14 @@ def on_complete(ok, results):
task.executed.connect(on_complete)
self.setCurrentTask(task)
else:
self.proxy_progress = QgsProxyProgressTask(self.tr("Executing “{}”").format(self.algorithm().displayName()))
QgsApplication.taskManager().addTask(self.proxy_progress)
feedback.progressChanged.connect(self.proxy_progress.setProxyProgress)
self.feedback_dialog = self.createProgressDialog()
self.feedback_dialog.show()
ok, results = execute(self.algorithm(), parameters, context, feedback)
feedback.progressChanged.disconnect()
self.proxy_progress.finalize(ok)
on_complete(ok, results)

except AlgorithmDialogBase.InvalidParameterValue as e:
Expand Down

0 comments on commit 94300ea

Please sign in to comment.