Skip to content

Commit 9256ca5

Browse files
committedJun 20, 2014
[processing] force process events when algorithms report progress
Not the ideal way of doing it, but it will do the trick until we safely put algorithms in a different thread Some cleaning of the main alg execution dialog
1 parent 9414717 commit 9256ca5

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed
 

‎python/plugins/processing/gui/AlgorithmExecutionDialog.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ def __init__(self, alg, mainWidget):
7676
self.resize(650, 450)
7777
self.buttonBox = QtGui.QDialogButtonBox()
7878
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
79-
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
80-
| QtGui.QDialogButtonBox.Close)
81-
self.buttonBox.button(QtGui.QDialogButtonBox.Cancel).setEnabled(False)
79+
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close)
8280
self.runButton = QtGui.QPushButton()
8381
self.runButton.setText('Run')
8482
self.buttonBox.addButton(self.runButton,
@@ -128,8 +126,6 @@ def __init__(self, alg, mainWidget):
128126
self.verticalLayout.addWidget(self.buttonBox)
129127
self.setLayout(self.verticalLayout)
130128
self.buttonBox.rejected.connect(self.close)
131-
self.buttonBox.button(
132-
QtGui.QDialogButtonBox.Cancel).clicked.connect(self.cancel)
133129

134130
self.showDebug = ProcessingConfig.getSetting(
135131
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
@@ -306,19 +302,6 @@ def error(self, msg):
306302
self.resetGUI()
307303
self.tabWidget.setCurrentIndex(1) # log tab
308304

309-
def iterate(self, i):
310-
self.setInfo('<b>Algorithm %s iteration #%i completed</b>'
311-
% (self.alg.name, i))
312-
313-
def cancel(self):
314-
self.setInfo('<b>Algorithm %s canceled</b>' % self.alg.name)
315-
try:
316-
self.algEx.algExecuted.disconnect()
317-
self.algEx.terminate()
318-
except:
319-
pass
320-
self.resetGUI()
321-
322305
def resetGUI(self):
323306
QApplication.restoreOverrideCursor()
324307
self.progressLabel.setText('')
@@ -333,24 +316,30 @@ def setInfo(self, msg, error=False):
333316
self.logText.append('<span style="color:red">' + msg + '</span>')
334317
else:
335318
self.logText.append(msg)
319+
QCoreApplication.processEvents()
336320

337321
def setCommand(self, cmd):
338322
if self.showDebug:
339323
self.setInfo('<tt>' + cmd + '<tt>')
324+
QCoreApplication.processEvents()
340325

341326
def setDebugInfo(self, msg):
342327
if self.showDebug:
343328
self.setInfo('<span style="color:blue">' + msg + '</span>')
329+
QCoreApplication.processEvents()
344330

345331
def setConsoleInfo(self, msg):
346332
if self.showDebug:
347333
self.setCommand('<span style="color:darkgray">' + msg + '</span>')
334+
QCoreApplication.processEvents()
348335

349336
def setPercentage(self, i):
350337
if self.progress.maximum() == 0:
351338
self.progress.setMaximum(100)
352339
self.progress.setValue(i)
340+
QCoreApplication.processEvents()
353341

354342
def setText(self, text):
355343
self.progressLabel.setText(text)
356344
self.setInfo(text, False)
345+
QCoreApplication.processEvents()

0 commit comments

Comments
 (0)
Please sign in to comment.