diff --git a/python/plugins/processing/gui/CouldNotLoadResultsDialog.py b/python/plugins/processing/gui/CouldNotLoadResultsDialog.py deleted file mode 100644 index 05f7d1cd9f3..00000000000 --- a/python/plugins/processing/gui/CouldNotLoadResultsDialog.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - CouldNotLoadResultsDialog.py - --------------------- - Date : August 2012 - Copyright : (C) 2012 by Victor Olaya - Email : volayaf at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -__author__ = 'Victor Olaya' -__date__ = 'August 2012' -__copyright__ = '(C) 2012, Victor Olaya' - -# This will get replaced with a git SHA1 when you do a git archive - -__revision__ = '$Format:%H$' - -import webbrowser -from PyQt4 import QtCore, QtGui -from PyQt4.QtCore import * -from PyQt4.QtGui import * - - -class CouldNotLoadResultsDialog(QtGui.QDialog): - - def __init__(self, wrongLayers, alg): - QtGui.QDialog.__init__(self, None, QtCore.Qt.WindowSystemMenuHint - | QtCore.Qt.WindowTitleHint) - self.alg = alg - self.wrongLayers = wrongLayers - self.setupUi() - - def setupUi(self): - self.resize(600, 350) - self.setWindowTitle(self.tr('Problem loading output layers')) - layout = QVBoxLayout() - browser = QtGui.QTextBrowser() - browser.setOpenLinks(False) - browser.anchorClicked.connect(self.linkClicked) - html = self.alg.getPostProcessingErrorMessage(self.wrongLayers) - browser.setHtml(html) - button = QPushButton() - button.setText(self.tr('Close')) - button.clicked.connect(self.closeButtonPressed) - buttonBox = QtGui.QDialogButtonBox() - buttonBox.setOrientation(QtCore.Qt.Horizontal) - buttonBox.addButton(button, QDialogButtonBox.ActionRole) - layout.addWidget(browser) - layout.addWidget(buttonBox) - self.setLayout(layout) - - def linkClicked(self, url): - webbrowser.open(str(url)) - - def closeButtonPressed(self): - self.close() diff --git a/python/plugins/processing/gui/MessageDialog.py b/python/plugins/processing/gui/MessageDialog.py new file mode 100644 index 00000000000..d2606fd50da --- /dev/null +++ b/python/plugins/processing/gui/MessageDialog.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + MessageDialog.py + --------------------- + Date : October 2014 + Copyright : (C) 2014 by Alexander Bruy + Email : alexander dot bruy at gmail dot com +*************************************************************************** +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +* * +*************************************************************************** +""" + +__author__ = 'Alexander Bruy' +__date__ = 'October 2014' +__copyright__ = '(C) 2014, Alexander Bruy' + +# This will get replaced with a git SHA1 when you do a git archive + +__revision__ = '$Format:%H$' + +from PyQt4.QtCore import * +from PyQt4.QtGui import * + + +from processing.ui.ui_DlgMessage import Ui_Dialog + + +class MessageDialog(QDialog, Ui_Dialog): + + def __init__(self): + QDialog.__init__(self) + self.setupUi(self) + + self.txtMessage.anchorClicked.connect(self.openLink) + + def setTitle(self, title): + self.setWindowTitle(title) + + def setMessage(self, message): + self.txtMessage.setHtml(message) + + def openLink(self, url): + QDesktopServices.openUrl(QUrl(url)) diff --git a/python/plugins/processing/gui/MissingDependencyDialog.py b/python/plugins/processing/gui/MissingDependencyDialog.py deleted file mode 100644 index 871a664f41e..00000000000 --- a/python/plugins/processing/gui/MissingDependencyDialog.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- - -""" -*************************************************************************** - MessingDependencyDialog.py - --------------------- - Date : April 2013 - Copyright : (C) 2013 by Victor Olaya - Email : volayaf at gmail dot com -*************************************************************************** -* * -* This program is free software; you can redistribute it and/or modify * -* it under the terms of the GNU General Public License as published by * -* the Free Software Foundation; either version 2 of the License, or * -* (at your option) any later version. * -* * -*************************************************************************** -""" - -__author__ = 'Victor Olaya' -__date__ = 'April 2013' -__copyright__ = '(C) 2013, Victor Olaya' - -# This will get replaced with a git SHA1 when you do a git archive - -__revision__ = '$Format:%H$' - -import webbrowser -from PyQt4 import QtCore, QtGui, QtWebKit -from PyQt4.QtCore import * -from PyQt4.QtGui import * - - -class MissingDependencyDialog(QtGui.QDialog): - - def __init__(self, msg): - QtGui.QDialog.__init__(self, None, QtCore.Qt.WindowSystemMenuHint - | QtCore.Qt.WindowTitleHint) - self.msg = self.tr('

Missing dependency.This algorithm cannot ' - 'be run :-(

\n%s') % msg - self.setupUi() - - def setupUi(self): - self.resize(500, 300) - self.setWindowTitle(self.tr('Missing dependency')) - layout = QVBoxLayout() - browser = QtGui.QTextBrowser() - browser.setOpenLinks(False) - browser.anchorClicked.connect(self.linkClicked) - browser.setHtml(self.msg) - button = QPushButton() - button.setText(self.tr('Close')) - button.clicked.connect(self.closeButtonPressed) - buttonBox = QtGui.QDialogButtonBox() - buttonBox.setOrientation(QtCore.Qt.Horizontal) - buttonBox.addButton(button, QDialogButtonBox.ActionRole) - layout.addWidget(browser) - layout.addWidget(buttonBox) - self.setLayout(layout) - QtCore.QMetaObject.connectSlotsByName(self) - - def linkClicked(self, url): - webbrowser.open(url.toString()) - - def closeButtonPressed(self): - self.close() diff --git a/python/plugins/processing/gui/Postprocessing.py b/python/plugins/processing/gui/Postprocessing.py index b8c5f5bc2e1..24b5cd6ab38 100644 --- a/python/plugins/processing/gui/Postprocessing.py +++ b/python/plugins/processing/gui/Postprocessing.py @@ -29,16 +29,20 @@ import os from PyQt4.QtGui import * from PyQt4.QtCore import * from qgis.core import * -from processing.gui.SilentProgress import SilentProgress + from processing.core.ProcessingConfig import ProcessingConfig +from processing.core.ProcessingResults import ProcessingResults + from processing.gui.ResultsDialog import ResultsDialog from processing.gui.RenderingStyles import RenderingStyles -from processing.gui.CouldNotLoadResultsDialog import CouldNotLoadResultsDialog +from processing.gui.MessageDialog import MessageDialog +from processing.gui.SilentProgress import SilentProgress + from processing.core.outputs import OutputRaster from processing.core.outputs import OutputVector from processing.core.outputs import OutputTable -from processing.core.ProcessingResults import ProcessingResults from processing.core.outputs import OutputHTML + from processing.tools import dataobjects def handleAlgorithmResults(alg, progress=None, showResults=True): @@ -74,7 +78,9 @@ def handleAlgorithmResults(alg, progress=None, showResults=True): i += 1 if wrongLayers: QApplication.restoreOverrideCursor() - dlg = CouldNotLoadResultsDialog(wrongLayers, alg) + dlg = MessageDialog() + dlg.setTitle(QCoreApplication.translate('Postprocessing', 'Problem loading output layers')) + dlg.setMessage(alg.getPostProcessingErrorMessage(wrongLayers)) dlg.exec_() if showResults and htmlResults and not wrongLayers: diff --git a/python/plugins/processing/gui/ProcessingToolbox.py b/python/plugins/processing/gui/ProcessingToolbox.py index 588ecc367bf..64de5ac7b7c 100644 --- a/python/plugins/processing/gui/ProcessingToolbox.py +++ b/python/plugins/processing/gui/ProcessingToolbox.py @@ -34,7 +34,7 @@ from processing.core.Processing import Processing from processing.core.ProcessingLog import ProcessingLog from processing.core.ProcessingConfig import ProcessingConfig from processing.core.GeoAlgorithm import GeoAlgorithm -from processing.gui.MissingDependencyDialog import MissingDependencyDialog +from processing.gui.MessageDialog import MessageDialog from processing.gui.AlgorithmClassification import AlgorithmDecorator from processing.gui.ParametersDialog import ParametersDialog from processing.gui.BatchProcessingDialog import BatchProcessingDialog @@ -186,7 +186,11 @@ class ProcessingToolbox(QDockWidget, Ui_ProcessingToolbox): alg = Processing.getAlgorithm(item.alg.commandLineName()) message = alg.checkBeforeOpeningParametersDialog() if message: - dlg = MissingDependencyDialog(message) + dlg = MessageDialog() + dlg.setTitle(self.tr('Missing dependency')) + dlg.setMessage( + self.tr('

Missing dependency. This algorithm cannot ' + 'be run :-(

\n%s') % message) dlg.exec_() return alg = alg.getCopy() diff --git a/python/plugins/processing/ui/DlgMessage.ui b/python/plugins/processing/ui/DlgMessage.ui new file mode 100644 index 00000000000..fd5ddd6bf64 --- /dev/null +++ b/python/plugins/processing/ui/DlgMessage.ui @@ -0,0 +1,71 @@ + + + Dialog + + + + 0 + 0 + 457 + 242 + + + + Dialog + + + + + + false + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +