Skip to content
Permalink
Browse files

Display execution dialog log in unthreaded mode if "keep open" option…

… is activated. Also make algorithm error messages non-modal, less obtrusive.

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@341 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
cpolymeris@gmail.com
cpolymeris@gmail.com committed Aug 10, 2012
1 parent f6f6124 commit 12c014ee5beece95f8902662f1ccad5c08efefd9
Showing with 9 additions and 8 deletions.
  1. +9 −8 src/sextante/gui/AlgorithmExecutionDialog.py
@@ -69,7 +69,9 @@ def __init__(self, alg, mainWidget):
self.verticalLayout.addWidget(self.tabWidget)
self.logText = QTextEdit()
self.logText.readOnly = True
if SextanteConfig.getSetting(SextanteConfig.USE_THREADS):
useThreads = SextanteConfig.getSetting(SextanteConfig.USE_THREADS)
keepOpen = SextanteConfig.getSetting(SextanteConfig.KEEP_DIALOG_OPEN)
if useThreads or keepOpen:
self.tabWidget.addTab(self.logText, "Log")
self.webView = QtWebKit.QWebView()
cssUrl = QtCore.QUrl(os.path.join(os.path.dirname(__file__), "help", "help.css"))
@@ -213,8 +215,8 @@ def accept(self):
self.algEx.start()
self.setInfo("<b>Algorithm %s started</b>" % self.alg.name)
self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).setEnabled(True)
self.tabWidget.setCurrentIndex(1) # log tab
else:
self.setInfo("<b>Algorithm %s starting...</b>" % self.alg.name)
if iterateParam:
UnthreadedAlgorithmExecutor.runalgIterating(self.alg, iterateParam, self)
else:
@@ -235,6 +237,7 @@ def accept(self):
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Close).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).setEnabled(False)
self.tabWidget.setCurrentIndex(1) # log tab
else:
QMessageBox.critical(self, "Unable to execute algorithm", "Wrong or missing parameter values")

@@ -259,13 +262,13 @@ def finish(self):
def error(self, msg):
self.algEx.finished.disconnect()
QApplication.restoreOverrideCursor()
self.setInfo(msg, True)
QMessageBox.critical(self, "Error", msg)
keepOpen = SextanteConfig.getSetting(SextanteConfig.KEEP_DIALOG_OPEN)
if not keepOpen:
self.setInfo(msg, True)
if not SextanteConfig.USE_THREADS and not keepOpen:
QMessageBox.critical(self, "Error", msg)
self.close()
else:
self.progressLabel.setText("")
self.progressLabel.setText("Error: " + msg)
self.progress.setValue(0)
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Close).setEnabled(True)
@@ -291,10 +294,8 @@ def cancel(self):
@pyqtSlot(str, bool)
def setInfo(self, msg, error = False):
if error:
#SextanteLog.addToLog(SextanteLog.LOG_ERROR, msg)
self.logText.append('<span style="color:red">' + msg + '</span>')
else:
#SextanteLog.addToLog(SextanteLog.LOG_INFO, msg)
self.logText.append(msg)

@pyqtSlot(str)

0 comments on commit 12c014e

Please sign in to comment.
You can’t perform that action at this time.