@@ -239,12 +239,7 @@ def accept(self):
239
239
if not keepOpen :
240
240
self .close ()
241
241
else :
242
- self .progressLabel .setText ("" )
243
- self .progress .setMaximum (100 )
244
- self .progress .setValue (0 )
245
- self .buttonBox .button (QtGui .QDialogButtonBox .Ok ).setEnabled (True )
246
- self .buttonBox .button (QtGui .QDialogButtonBox .Close ).setEnabled (True )
247
- self .buttonBox .button (QtGui .QDialogButtonBox .Cancel ).setEnabled (False )
242
+ self .resetGUI ()
248
243
self .tabWidget .setCurrentIndex (1 ) # log tab
249
244
except AlgorithmExecutionDialog .InvalidParameterValue as ex :
250
245
try :
@@ -262,32 +257,26 @@ def finish(self):
262
257
keepOpen = SextanteConfig .getSetting (SextanteConfig .KEEP_DIALOG_OPEN )
263
258
SextantePostprocessing .handleAlgorithmResults (self .alg , not keepOpen )
264
259
self .executed = True
265
- self .setInfo ("Algorithm %s finished correctly " % self .alg .name )
260
+ self .setInfo ("Algorithm %s finished" % self .alg .name )
266
261
QApplication .restoreOverrideCursor ()
267
262
if not keepOpen :
268
263
self .close ()
269
264
else :
270
- self .progressLabel .setText ("" )
271
- self .progress .setMaximum (100 )
272
- self .progress .setValue (0 )
273
- self .buttonBox .button (QtGui .QDialogButtonBox .Ok ).setEnabled (True )
274
- self .buttonBox .button (QtGui .QDialogButtonBox .Close ).setEnabled (True )
275
- self .buttonBox .button (QtGui .QDialogButtonBox .Cancel ).setEnabled (False )
265
+ self .resetGUI ()
276
266
277
267
@pyqtSlot (str )
278
268
def error (self , msg ):
279
- self .algEx .finished .disconnect ()
280
269
QApplication .restoreOverrideCursor ()
281
270
keepOpen = SextanteConfig .getSetting (SextanteConfig .KEEP_DIALOG_OPEN )
282
271
self .setInfo (msg , True )
283
- if not SextanteConfig .USE_THREADS and not keepOpen :
272
+ self .algEx .finished .disconnect ()
273
+ if not keepOpen :
284
274
QMessageBox .critical (self , "Error" , msg )
285
275
self .close ()
286
276
else :
287
- self .progressLabel .setText ("Error: " + msg )
288
- self .progress .setValue (0 )
289
- self .buttonBox .button (QtGui .QDialogButtonBox .Ok ).setEnabled (True )
290
- self .buttonBox .button (QtGui .QDialogButtonBox .Close ).setEnabled (True )
277
+ self .resetGUI ()
278
+ self .setInfo (msg , True )
279
+ self .tabWidget .setCurrentIndex (1 ) # log tab
291
280
292
281
@pyqtSlot (int )
293
282
def iterate (self , i ):
@@ -299,12 +288,19 @@ def cancel(self):
299
288
try :
300
289
self .algEx .finished .disconnect ()
301
290
self .algEx .terminate ()
302
- QApplication .restoreOverrideCursor ()
303
- self .buttonBox .button (QtGui .QDialogButtonBox .Ok ).setEnabled (True )
304
- self .buttonBox .button (QtGui .QDialogButtonBox .Close ).setEnabled (True )
305
- self .buttonBox .button (QtGui .QDialogButtonBox .Cancel ).setEnabled (False )
306
291
except :
307
292
pass
293
+ self .resetGUI ()
294
+
295
+ def resetGUI (self ):
296
+ QApplication .restoreOverrideCursor ()
297
+ self .progressLabel .setText ("" )
298
+ self .progress .setValue (0 )
299
+ self .progress .setMaximum (100 )
300
+ self .buttonBox .button (QtGui .QDialogButtonBox .Ok ).setEnabled (True )
301
+ self .buttonBox .button (QtGui .QDialogButtonBox .Close ).setEnabled (True )
302
+ self .buttonBox .button (QtGui .QDialogButtonBox .Cancel ).setEnabled (False )
303
+
308
304
309
305
@pyqtSlot (str )
310
306
@pyqtSlot (str , bool )
0 commit comments