Skip to content

Commit 67d70f8

Browse files
committedSep 29, 2015
[processing] Fix multiple error dialogs in batch processes
Errors when postprocessing layers are now added to the log console
1 parent 1c69373 commit 67d70f8

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed
 

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def __init__(self, alg):
8585
self.showDebug = ProcessingConfig.getSetting(
8686
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
8787

88+
8889
def closeEvent(self, evt):
8990
self.settings.setValue("/Processing/dialogBase", self.saveGeometry())
9091

@@ -107,7 +108,7 @@ def resetGUI(self):
107108

108109
def setInfo(self, msg, error=False):
109110
if error:
110-
self.txtLog.append('<span style="color:red">%s</span>' % msg)
111+
self.txtLog.append('<span style="color:red"><br>%s<br></span>' % msg)
111112
else:
112113
self.txtLog.append(msg)
113114
QCoreApplication.processEvents()

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
***************************************************************************
1818
"""
1919

20+
2021
__author__ = 'Victor Olaya'
2122
__date__ = 'April 2013'
2223
__copyright__ = '(C) 2013, Victor Olaya'
@@ -29,11 +30,13 @@
2930
from PyQt4.QtGui import QProgressBar
3031
from qgis.utils import iface
3132
from qgis.gui import QgsMessageBar
32-
33+
from processing.core.ProcessingLog import ProcessingLog
34+
from processing.gui.MessageDialog import MessageDialog
3335

3436
class MessageBarProgress:
3537

3638
def __init__(self, algname=None):
39+
self.msg = []
3740
self.progressMessageBar = \
3841
iface.messageBar().createMessage(self.tr('Executing algorithm <i>{0}</i>'.format(algname if algname else '')))
3942
self.progress = QProgressBar()
@@ -44,9 +47,8 @@ def __init__(self, algname=None):
4447
iface.messageBar().INFO)
4548

4649
def error(self, msg):
47-
iface.messageBar().clearWidgets()
48-
iface.messageBar().pushMessage(self.tr('Error'),
49-
msg, level=QgsMessageBar.CRITICAL, duration=3)
50+
self.msg.append(msg)
51+
5052

5153
def setText(self, text):
5254
pass
@@ -67,6 +69,11 @@ def setConsoleInfo(self, _):
6769
pass
6870

6971
def close(self):
72+
if self.msg:
73+
dlg = MessageDialog()
74+
dlg.setTitle(QCoreApplication.translate('MessageBarProgress', 'Problem executing algorithm'))
75+
dlg.setMessage("<br>".join(self.msg))
76+
dlg.exec_()
7077
iface.messageBar().clearWidgets()
7178

7279
def tr(self, string, context=''):

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,16 @@ def handleAlgorithmResults(alg, progress=None, showResults=True):
7777
ProcessingResults.addResult(out.description, out.value)
7878
htmlResults = True
7979
i += 1
80+
81+
QApplication.restoreOverrideCursor()
8082
if wrongLayers:
81-
QApplication.restoreOverrideCursor()
82-
dlg = MessageDialog()
83-
dlg.setTitle(QCoreApplication.translate('Postprocessing', 'Problem loading output layers'))
8483
msg = "The following layers were not correctly generated.<ul>"
8584
msg += "".join(["<li>%s</li>" % lay for lay in wrongLayers]) + "</ul>"
86-
msg += "You can check the <a href='log'>log messages</a> to find more information about the execution of the algorithm"
87-
dlg.setMessage(msg)
88-
dlg.exec_()
85+
msg += "You can check the log messages to find more information about the execution of the algorithm"
86+
progress.error(msg)
87+
8988

9089
if showResults and htmlResults and not wrongLayers:
91-
QApplication.restoreOverrideCursor()
9290
dlg = ResultsDialog()
9391
dlg.exec_()
9492

0 commit comments

Comments
 (0)
Please sign in to comment.