@@ -69,7 +69,9 @@ def __init__(self, alg, mainWidget):
69
69
self .verticalLayout .addWidget (self .tabWidget )
70
70
self .logText = QTextEdit ()
71
71
self .logText .readOnly = True
72
- if SextanteConfig .getSetting (SextanteConfig .USE_THREADS ):
72
+ useThreads = SextanteConfig .getSetting (SextanteConfig .USE_THREADS )
73
+ keepOpen = SextanteConfig .getSetting (SextanteConfig .KEEP_DIALOG_OPEN )
74
+ if useThreads or keepOpen :
73
75
self .tabWidget .addTab (self .logText , "Log" )
74
76
self .webView = QtWebKit .QWebView ()
75
77
cssUrl = QtCore .QUrl (os .path .join (os .path .dirname (__file__ ), "help" , "help.css" ))
@@ -213,8 +215,8 @@ def accept(self):
213
215
self .algEx .start ()
214
216
self .setInfo ("<b>Algorithm %s started</b>" % self .alg .name )
215
217
self .buttonBox .button (QtGui .QDialogButtonBox .Cancel ).setEnabled (True )
216
- self .tabWidget .setCurrentIndex (1 ) # log tab
217
218
else :
219
+ self .setInfo ("<b>Algorithm %s starting...</b>" % self .alg .name )
218
220
if iterateParam :
219
221
UnthreadedAlgorithmExecutor .runalgIterating (self .alg , iterateParam , self )
220
222
else :
@@ -235,6 +237,7 @@ def accept(self):
235
237
self .buttonBox .button (QtGui .QDialogButtonBox .Ok ).setEnabled (True )
236
238
self .buttonBox .button (QtGui .QDialogButtonBox .Close ).setEnabled (True )
237
239
self .buttonBox .button (QtGui .QDialogButtonBox .Cancel ).setEnabled (False )
240
+ self .tabWidget .setCurrentIndex (1 ) # log tab
238
241
else :
239
242
QMessageBox .critical (self , "Unable to execute algorithm" , "Wrong or missing parameter values" )
240
243
@@ -259,13 +262,13 @@ def finish(self):
259
262
def error (self , msg ):
260
263
self .algEx .finished .disconnect ()
261
264
QApplication .restoreOverrideCursor ()
262
- self .setInfo (msg , True )
263
- QMessageBox .critical (self , "Error" , msg )
264
265
keepOpen = SextanteConfig .getSetting (SextanteConfig .KEEP_DIALOG_OPEN )
265
- if not keepOpen :
266
+ self .setInfo (msg , True )
267
+ if not SextanteConfig .USE_THREADS and not keepOpen :
268
+ QMessageBox .critical (self , "Error" , msg )
266
269
self .close ()
267
270
else :
268
- self .progressLabel .setText ("" )
271
+ self .progressLabel .setText ("Error: " + msg )
269
272
self .progress .setValue (0 )
270
273
self .buttonBox .button (QtGui .QDialogButtonBox .Ok ).setEnabled (True )
271
274
self .buttonBox .button (QtGui .QDialogButtonBox .Close ).setEnabled (True )
@@ -291,10 +294,8 @@ def cancel(self):
291
294
@pyqtSlot (str , bool )
292
295
def setInfo (self , msg , error = False ):
293
296
if error :
294
- #SextanteLog.addToLog(SextanteLog.LOG_ERROR, msg)
295
297
self .logText .append ('<span style="color:red">' + msg + '</span>' )
296
298
else :
297
- #SextanteLog.addToLog(SextanteLog.LOG_INFO, msg)
298
299
self .logText .append (msg )
299
300
300
301
@pyqtSlot (str )
0 commit comments