[processing] better behaviour for fields calculator custom dialog

This commit is contained in:
volaya 2014-11-21 09:10:08 +01:00
parent 05dc06d41e
commit df9372a85b

View File

@ -47,7 +47,7 @@ from ui_DlgFieldsCalculator import Ui_FieldsCalculator
class FieldsCalculatorDialog(QDialog, Ui_FieldsCalculator):
def __init__(self, alg):
QDialog.__init__(self)
self.setupUi( self )
self.setupUi(self)
self.executed = False
self.alg = alg
@ -196,26 +196,21 @@ class FieldsCalculatorDialog(QDialog, Ui_FieldsCalculator):
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
ProcessingLog.addToLog(ProcessingLog.LOG_ALGORITHM,
self.alg.getAsCommand())
ret = runalg(self.alg, self)
QApplication.restoreOverrideCursor()
if ret:
self.executed = runalg(self.alg, self)
if self.executed:
handleAlgorithmResults(self.alg,
self,
not keepOpen)
self.executed = True
QDialog.reject(self)
if not keepOpen:
QDialog.reject(self)
else:
QMessageBox.critical(self,
self.tr('Unable to execute algorithm'),
self.tr('Wrong or missing parameter '
'values'))
return
except GeoAlgorithmExecutionException, e:
finally:
QApplication.restoreOverrideCursor()
QMessageBox.critical(self, "Error",e.msg)
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, e.msg)
self.executed = False
QDialog.reject(self)
def reject(self):
self.executed = False
@ -228,4 +223,5 @@ class FieldsCalculatorDialog(QDialog, Ui_FieldsCalculator):
pass
def error(self, text):
QMessageBox.critical(self, "Error", text)
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, text)