Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
History algorithm execution progress & cancel button.
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@277 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
cpolymeris@gmail.com committed Jul 1, 2012
1 parent 0d475df commit 655bd11
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/sextante/core/Sextante.py
Expand Up @@ -358,16 +358,32 @@ def runandload(name, *args):
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
if SextanteConfig.getSetting(SextanteConfig.USE_THREADS):
algEx = AlgorithmExecutor(alg)
progress = QProgressDialog()
progress.setWindowTitle(alg.name)
progress.setLabelText("Executing %s..." % alg.name)
def finish():
SextantePostprocessing.handleAlgorithmResults(alg)
QApplication.restoreOverrideCursor()
progress.close()
def error(msg):
QApplication.restoreOverrideCursor()
QMessageBox.critical(None, "Error", msg)
SextanteLog.addToLog(SextanteLog.LOG_ERROR, msg)
def cancel():
try:
algEx.finished.disconnect()
algEx.terminate()
QApplication.restoreOverrideCursor()
progress.close()
except:
pass
algEx.error.connect(error)
algEx.finished.connect(finish)
algEx.textChanged.connect(lambda t: progress.setLabelText(t))
algEx.percentageChanged.connect(lambda x: progress.setValue(x))
progress.canceled.connect(cancel)
algEx.start()
progress.show()
else:
if UnthreadedAlgorithmExecutor.runalg(alg, SilentProgress()):
SextantePostprocessing.handleAlgorithmResults(alg)
Expand Down

0 comments on commit 655bd11

Please sign in to comment.