Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] better behaviour for fields calculator custom dialog
  • Loading branch information
volaya committed Nov 21, 2014
1 parent 05dc06d commit df9372a
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions python/plugins/processing/algs/qgis/ui/FieldsCalculatorDialog.py
Expand Up @@ -47,7 +47,7 @@
class FieldsCalculatorDialog(QDialog, Ui_FieldsCalculator):
def __init__(self, alg):
QDialog.__init__(self)
self.setupUi( self )
self.setupUi(self)

self.executed = False
self.alg = alg
Expand Down Expand Up @@ -196,26 +196,21 @@ def accept(self):
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
Expand All @@ -228,4 +223,5 @@ def setText(self, text):
pass

def error(self, text):
QMessageBox.critical(self, "Error", text)
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR, text)

0 comments on commit df9372a

Please sign in to comment.