Skip to content
Permalink
Browse files

[processing] Use a proxy task for batch processing execution

  • Loading branch information
nyalldawson committed Sep 7, 2018
1 parent 5030121 commit db1600871ae3fdbbfceec3732a2b46b781e321b8
Showing with 6 additions and 3 deletions.
  1. +6 −3 python/plugins/processing/gui/BatchAlgorithmDialog.py
@@ -40,7 +40,8 @@
QgsProcessingOutputNumber,
QgsProcessingOutputString,
QgsProject,
Qgis)
Qgis,
QgsScopedProxyProgressTask)

from qgis.gui import QgsProcessingAlgorithmDialogBase
from qgis.utils import OverrideCursor
@@ -115,6 +116,8 @@ def accept(self):

alg_parameters.append(parameters)

task = QgsScopedProxyProgressTask(self.tr('Batch Processing - {0}').format(self.algorithm().displayName()))

with OverrideCursor(Qt.WaitCursor):

self.mainWidget().setEnabled(False)
@@ -135,6 +138,7 @@ def accept(self):
break
self.setProgressText(QCoreApplication.translate('BatchAlgorithmDialog', '\nProcessing algorithm {0}/{1}…').format(count + 1, len(alg_parameters)))
self.setInfo(self.tr('<b>Algorithm {0} starting&hellip;</b>').format(self.algorithm().displayName()), escapeHtml=False)
task.setProgress(100 * count / len(alg_parameters))

parameters = self.algorithm().preprocessParameters(parameters)

@@ -165,6 +169,7 @@ def accept(self):
handleAlgorithmResults(self.algorithm(), context, feedback, False)

feedback.pushInfo(self.tr('Batch execution completed in {0:0.2f} seconds'.format(time.time() - start_time)))
task = None

self.finish(algorithm_results)
self.cancelButton().setEnabled(False)
@@ -175,8 +180,6 @@ def finish(self, algorithm_results):

self.createSummaryTable(algorithm_results)
self.mainWidget().setEnabled(True)
QMessageBox.information(self, self.tr('Batch processing'),
self.tr('Batch processing completed'))

def loadHTMLResults(self, results, num):
for out in self.algorithm().outputDefinitions():

0 comments on commit db16008

Please sign in to comment.
You can’t perform that action at this time.