40
40
QgsProcessingOutputNumber ,
41
41
QgsProcessingOutputString ,
42
42
QgsProject ,
43
- Qgis )
43
+ Qgis ,
44
+ QgsScopedProxyProgressTask )
44
45
45
46
from qgis .gui import QgsProcessingAlgorithmDialogBase
46
47
from qgis .utils import OverrideCursor
@@ -115,6 +116,8 @@ def accept(self):
115
116
116
117
alg_parameters .append (parameters )
117
118
119
+ task = QgsScopedProxyProgressTask (self .tr ('Batch Processing - {0}' ).format (self .algorithm ().displayName ()))
120
+
118
121
with OverrideCursor (Qt .WaitCursor ):
119
122
120
123
self .mainWidget ().setEnabled (False )
@@ -135,6 +138,7 @@ def accept(self):
135
138
break
136
139
self .setProgressText (QCoreApplication .translate ('BatchAlgorithmDialog' , '\n Processing algorithm {0}/{1}…' ).format (count + 1 , len (alg_parameters )))
137
140
self .setInfo (self .tr ('<b>Algorithm {0} starting…</b>' ).format (self .algorithm ().displayName ()), escapeHtml = False )
141
+ task .setProgress (100 * count / len (alg_parameters ))
138
142
139
143
parameters = self .algorithm ().preprocessParameters (parameters )
140
144
@@ -165,6 +169,7 @@ def accept(self):
165
169
handleAlgorithmResults (self .algorithm (), context , feedback , False )
166
170
167
171
feedback .pushInfo (self .tr ('Batch execution completed in {0:0.2f} seconds' .format (time .time () - start_time )))
172
+ task = None
168
173
169
174
self .finish (algorithm_results )
170
175
self .cancelButton ().setEnabled (False )
@@ -175,8 +180,6 @@ def finish(self, algorithm_results):
175
180
176
181
self .createSummaryTable (algorithm_results )
177
182
self .mainWidget ().setEnabled (True )
178
- QMessageBox .information (self , self .tr ('Batch processing' ),
179
- self .tr ('Batch processing completed' ))
180
183
181
184
def loadHTMLResults (self , results , num ):
182
185
for out in self .algorithm ().outputDefinitions ():
0 commit comments