Skip to content

Commit db16008

Browse files
committed
[processing] Use a proxy task for batch processing execution
1 parent 5030121 commit db16008

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

python/plugins/processing/gui/BatchAlgorithmDialog.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@
4040
QgsProcessingOutputNumber,
4141
QgsProcessingOutputString,
4242
QgsProject,
43-
Qgis)
43+
Qgis,
44+
QgsScopedProxyProgressTask)
4445

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

116117
alg_parameters.append(parameters)
117118

119+
task = QgsScopedProxyProgressTask(self.tr('Batch Processing - {0}').format(self.algorithm().displayName()))
120+
118121
with OverrideCursor(Qt.WaitCursor):
119122

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

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

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

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

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

176181
self.createSummaryTable(algorithm_results)
177182
self.mainWidget().setEnabled(True)
178-
QMessageBox.information(self, self.tr('Batch processing'),
179-
self.tr('Batch processing completed'))
180183

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

0 commit comments

Comments
 (0)