Skip to content

Commit

Permalink
Correct non-sensical code in error behaviour.
Browse files Browse the repository at this point in the history
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@345 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
cpolymeris@gmail.com committed Aug 10, 2012
1 parent 73eb3f1 commit 2aa1c70
Showing 1 changed file with 19 additions and 23 deletions.
42 changes: 19 additions & 23 deletions src/sextante/gui/AlgorithmExecutionDialog.py
Expand Up @@ -239,12 +239,7 @@ def accept(self):
if not keepOpen:
self.close()
else:
self.progressLabel.setText("")
self.progress.setMaximum(100)
self.progress.setValue(0)
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.resetGUI()
self.tabWidget.setCurrentIndex(1) # log tab
except AlgorithmExecutionDialog.InvalidParameterValue as ex:
try:
Expand All @@ -262,32 +257,26 @@ def finish(self):
keepOpen = SextanteConfig.getSetting(SextanteConfig.KEEP_DIALOG_OPEN)
SextantePostprocessing.handleAlgorithmResults(self.alg, not keepOpen)
self.executed = True
self.setInfo("Algorithm %s finished correctly" % self.alg.name)
self.setInfo("Algorithm %s finished" % self.alg.name)
QApplication.restoreOverrideCursor()
if not keepOpen:
self.close()
else:
self.progressLabel.setText("")
self.progress.setMaximum(100)
self.progress.setValue(0)
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.resetGUI()

@pyqtSlot(str)
def error(self, msg):
self.algEx.finished.disconnect()
QApplication.restoreOverrideCursor()
keepOpen = SextanteConfig.getSetting(SextanteConfig.KEEP_DIALOG_OPEN)
self.setInfo(msg, True)
if not SextanteConfig.USE_THREADS and not keepOpen:
self.algEx.finished.disconnect()
if not keepOpen:
QMessageBox.critical(self, "Error", msg)
self.close()
else:
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)
self.resetGUI()
self.setInfo(msg, True)
self.tabWidget.setCurrentIndex(1) # log tab

@pyqtSlot(int)
def iterate(self, i):
Expand All @@ -299,12 +288,19 @@ def cancel(self):
try:
self.algEx.finished.disconnect()
self.algEx.terminate()
QApplication.restoreOverrideCursor()
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Close).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).setEnabled(False)
except:
pass
self.resetGUI()

def resetGUI(self):
QApplication.restoreOverrideCursor()
self.progressLabel.setText("")
self.progress.setValue(0)
self.progress.setMaximum(100)
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Close).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).setEnabled(False)


@pyqtSlot(str)
@pyqtSlot(str, bool)
Expand Down

0 comments on commit 2aa1c70

Please sign in to comment.