@@ -95,19 +95,16 @@ def okPressed(self):
95
95
QMessageBox .critical (self , "Unable to execute batch process" , "Wrong or missing parameter values" )
96
96
self .algs = None
97
97
return
98
- row += 1
98
+ #~ row+=1 ??? - why?
99
99
self .algs .append (alg )
100
100
101
101
QApplication .setOverrideCursor (QCursor (Qt .WaitCursor ))
102
102
self .progress .setMaximum (len (self .algs ))
103
- for alg in self .algs :
104
- algEx = AlgorithmExecutor (alg );
105
- algEx .start ()
106
-
107
- QApplication .restoreOverrideCursor ()
108
- QMessageBox .information (self , "Batch processing" , "Batch processing successfully completed!" )
109
- self .close ()
110
-
103
+ self .progress .setValue (0 )
104
+ self .nextAlg (0 )
105
+
106
+ self .table .setEnabled (False )
107
+
111
108
def loadHTMLResults (self , alg , i ):
112
109
for out in alg .outputs :
113
110
if out .hidden or not out .open :
@@ -119,6 +116,31 @@ def cancelPressed(self):
119
116
self .algs = None
120
117
self .close ()
121
118
119
+ @pyqtSlot ()
120
+ def finish (self , i ):
121
+ i += 1
122
+ self .progress .setValue (i )
123
+ if len (self .algs ) == i :
124
+ self .finishAll ()
125
+ self .algEx = None
126
+ else :
127
+ self .nextAlg (i )
128
+
129
+ def nextAlg (self , i ):
130
+ self .algEx = AlgorithmExecutor (self .algs [i ]);
131
+ self .algEx .finished .connect (lambda : self .finish (i ))
132
+ self .algEx .start ()
133
+
134
+ def finishAll (self ):
135
+ i = 0
136
+ for alg in self .algs :
137
+ self .loadHTMLResults (alg , i )
138
+ i = i + 1
139
+ QApplication .restoreOverrideCursor ()
140
+ self .table .setEnabled (True )
141
+ QMessageBox .information (self , "Batch processing" , "Batch processing successfully completed!" )
142
+ self .close ()
143
+
122
144
def setParameterValueFromWidget (self , param , widget ):
123
145
if isinstance (param , (ParameterRaster , ParameterVector , ParameterTable , ParameterMultipleInput )):
124
146
return param .setValue (widget .getText ())
0 commit comments