Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] improved non-threaded execution
  • Loading branch information
volaya committed Sep 14, 2013
1 parent d69667b commit 2e3765b
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions python/plugins/processing/gui/AlgorithmExecutionDialog.py
Expand Up @@ -194,6 +194,7 @@ def accept(self):
checkCRS = ProcessingConfig.getSetting(ProcessingConfig.WARN_UNMATCHING_CRS)
keepOpen = ProcessingConfig.getSetting(ProcessingConfig.KEEP_DIALOG_OPEN)
useThread = ProcessingConfig.getSetting(ProcessingConfig.USE_THREADS)
self.showDebug = ProcessingConfig.getSetting(ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
try:
self.setParamValues()
if checkCRS and not self.alg.checkInputCRS():
Expand All @@ -219,6 +220,7 @@ def accept(self):
self.iterateParam = buttons.keys()[i]
break

self.tabWidget.setCurrentIndex(1) # log tab
self.progress.setMaximum(0)
self.progressLabel.setText("Processing algorithm...")
QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
Expand All @@ -232,15 +234,14 @@ def accept(self):
self.algEx.percentageChanged.connect(self.setPercentage)
self.algEx.textChanged.connect(self.setText)
self.algEx.iterated.connect(self.iterate)
self.algEx.infoSet.connect(self.setInfo)
if ProcessingConfig.getSetting(ProcessingConfig.SHOW_DEBUG_IN_DIALOG):
self.algEx.commandSet.connect(self.setCommand)
self.algEx.debugInfoSet.connect(self.setDebugInfo)
self.algEx.consoleInfoSet.connect(self.setConsoleInfo)
self.algEx.infoSet.connect(self.setInfo)
self.algEx.commandSet.connect(self.setCommand)
self.algEx.debugInfoSet.connect(self.setDebugInfo)
self.algEx.consoleInfoSet.connect(self.setConsoleInfo)
self.algEx.start()
self.setInfo("<b>Algorithm %s started</b>" % self.alg.name)
self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).setEnabled(True)
else:
else:
self.setInfo("<b>Algorithm %s starting...</b>" % self.alg.name)
if self.iterateParam:
if UnthreadedAlgorithmExecutor.runalgIterating(self.alg, self.iterateParam, self):
Expand All @@ -262,8 +263,7 @@ def accept(self):
if not keepOpen:
self.close()
else:
self.resetGUI()
self.tabWidget.setCurrentIndex(1) # log tab
self.resetGUI()
except AlgorithmExecutionDialog.InvalidParameterValue as ex:
try:
self.buttonBox.accepted.connect(lambda: ex.widget.setPalette(QPalette()))
Expand Down Expand Up @@ -336,15 +336,18 @@ def setInfo(self, msg, error = False):

@pyqtSlot(str)
def setCommand(self, cmd):
self.setInfo('<tt>' + cmd + '<tt>')
if self.showDebug:
self.setInfo('<tt>' + cmd + '<tt>')

@pyqtSlot(str)
def setDebugInfo(self, msg):
self.setInfo('<span style="color:blue">' + msg + '</span>')
if self.showDebug:
self.setInfo('<span style="color:blue">' + msg + '</span>')

@pyqtSlot(str)
def setConsoleInfo(self, msg):
self.setCommand('<span style="color:darkgray">' + msg + '</span>')
if self.showDebug:
self.setCommand('<span style="color:darkgray">' + msg + '</span>')

def setPercentage(self, i):
if self.progress.maximum() == 0:
Expand Down

0 comments on commit 2e3765b

Please sign in to comment.