mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
[processing] Fix multiple error dialogs in batch processes
Errors when postprocessing layers are now added to the log console
This commit is contained in:
parent
1c69373af1
commit
67d70f8572
@ -85,6 +85,7 @@ class AlgorithmDialogBase(BASE, WIDGET):
|
||||
self.showDebug = ProcessingConfig.getSetting(
|
||||
ProcessingConfig.SHOW_DEBUG_IN_DIALOG)
|
||||
|
||||
|
||||
def closeEvent(self, evt):
|
||||
self.settings.setValue("/Processing/dialogBase", self.saveGeometry())
|
||||
|
||||
@ -107,7 +108,7 @@ class AlgorithmDialogBase(BASE, WIDGET):
|
||||
|
||||
def setInfo(self, msg, error=False):
|
||||
if error:
|
||||
self.txtLog.append('<span style="color:red">%s</span>' % msg)
|
||||
self.txtLog.append('<span style="color:red"><br>%s<br></span>' % msg)
|
||||
else:
|
||||
self.txtLog.append(msg)
|
||||
QCoreApplication.processEvents()
|
||||
|
@ -17,6 +17,7 @@
|
||||
***************************************************************************
|
||||
"""
|
||||
|
||||
|
||||
__author__ = 'Victor Olaya'
|
||||
__date__ = 'April 2013'
|
||||
__copyright__ = '(C) 2013, Victor Olaya'
|
||||
@ -29,11 +30,13 @@ from PyQt4.QtCore import Qt, QCoreApplication
|
||||
from PyQt4.QtGui import QProgressBar
|
||||
from qgis.utils import iface
|
||||
from qgis.gui import QgsMessageBar
|
||||
|
||||
from processing.core.ProcessingLog import ProcessingLog
|
||||
from processing.gui.MessageDialog import MessageDialog
|
||||
|
||||
class MessageBarProgress:
|
||||
|
||||
def __init__(self, algname=None):
|
||||
self.msg = []
|
||||
self.progressMessageBar = \
|
||||
iface.messageBar().createMessage(self.tr('Executing algorithm <i>{0}</i>'.format(algname if algname else '')))
|
||||
self.progress = QProgressBar()
|
||||
@ -44,9 +47,8 @@ class MessageBarProgress:
|
||||
iface.messageBar().INFO)
|
||||
|
||||
def error(self, msg):
|
||||
iface.messageBar().clearWidgets()
|
||||
iface.messageBar().pushMessage(self.tr('Error'),
|
||||
msg, level=QgsMessageBar.CRITICAL, duration=3)
|
||||
self.msg.append(msg)
|
||||
|
||||
|
||||
def setText(self, text):
|
||||
pass
|
||||
@ -67,6 +69,11 @@ class MessageBarProgress:
|
||||
pass
|
||||
|
||||
def close(self):
|
||||
if self.msg:
|
||||
dlg = MessageDialog()
|
||||
dlg.setTitle(QCoreApplication.translate('MessageBarProgress', 'Problem executing algorithm'))
|
||||
dlg.setMessage("<br>".join(self.msg))
|
||||
dlg.exec_()
|
||||
iface.messageBar().clearWidgets()
|
||||
|
||||
def tr(self, string, context=''):
|
||||
|
@ -77,18 +77,16 @@ def handleAlgorithmResults(alg, progress=None, showResults=True):
|
||||
ProcessingResults.addResult(out.description, out.value)
|
||||
htmlResults = True
|
||||
i += 1
|
||||
|
||||
QApplication.restoreOverrideCursor()
|
||||
if wrongLayers:
|
||||
QApplication.restoreOverrideCursor()
|
||||
dlg = MessageDialog()
|
||||
dlg.setTitle(QCoreApplication.translate('Postprocessing', 'Problem loading output layers'))
|
||||
msg = "The following layers were not correctly generated.<ul>"
|
||||
msg += "".join(["<li>%s</li>" % lay for lay in wrongLayers]) + "</ul>"
|
||||
msg += "You can check the <a href='log'>log messages</a> to find more information about the execution of the algorithm"
|
||||
dlg.setMessage(msg)
|
||||
dlg.exec_()
|
||||
msg += "You can check the log messages to find more information about the execution of the algorithm"
|
||||
progress.error(msg)
|
||||
|
||||
|
||||
if showResults and htmlResults and not wrongLayers:
|
||||
QApplication.restoreOverrideCursor()
|
||||
dlg = ResultsDialog()
|
||||
dlg.exec_()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user