Skip to content

Commit 6ff4877

Browse files
committedNov 17, 2014
[processing] replace two similar dialogs with generic one
1 parent eee616c commit 6ff4877

File tree

6 files changed

+137
-138
lines changed

6 files changed

+137
-138
lines changed
 

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

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
MessageDialog.py
6+
---------------------
7+
Date : October 2014
8+
Copyright : (C) 2014 by Alexander Bruy
9+
Email : alexander dot bruy at gmail dot com
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Alexander Bruy'
21+
__date__ = 'October 2014'
22+
__copyright__ = '(C) 2014, Alexander Bruy'
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
from PyQt4.QtCore import *
29+
from PyQt4.QtGui import *
30+
31+
32+
from processing.ui.ui_DlgMessage import Ui_Dialog
33+
34+
35+
class MessageDialog(QDialog, Ui_Dialog):
36+
37+
def __init__(self):
38+
QDialog.__init__(self)
39+
self.setupUi(self)
40+
41+
self.txtMessage.anchorClicked.connect(self.openLink)
42+
43+
def setTitle(self, title):
44+
self.setWindowTitle(title)
45+
46+
def setMessage(self, message):
47+
self.txtMessage.setHtml(message)
48+
49+
def openLink(self, url):
50+
QDesktopServices.openUrl(QUrl(url))

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

Lines changed: 0 additions & 66 deletions
This file was deleted.

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,20 @@
2929
from PyQt4.QtGui import *
3030
from PyQt4.QtCore import *
3131
from qgis.core import *
32-
from processing.gui.SilentProgress import SilentProgress
32+
3333
from processing.core.ProcessingConfig import ProcessingConfig
34+
from processing.core.ProcessingResults import ProcessingResults
35+
3436
from processing.gui.ResultsDialog import ResultsDialog
3537
from processing.gui.RenderingStyles import RenderingStyles
36-
from processing.gui.CouldNotLoadResultsDialog import CouldNotLoadResultsDialog
38+
from processing.gui.MessageDialog import MessageDialog
39+
from processing.gui.SilentProgress import SilentProgress
40+
3741
from processing.core.outputs import OutputRaster
3842
from processing.core.outputs import OutputVector
3943
from processing.core.outputs import OutputTable
40-
from processing.core.ProcessingResults import ProcessingResults
4144
from processing.core.outputs import OutputHTML
45+
4246
from processing.tools import dataobjects
4347

4448
def handleAlgorithmResults(alg, progress=None, showResults=True):
@@ -74,7 +78,9 @@ def handleAlgorithmResults(alg, progress=None, showResults=True):
7478
i += 1
7579
if wrongLayers:
7680
QApplication.restoreOverrideCursor()
77-
dlg = CouldNotLoadResultsDialog(wrongLayers, alg)
81+
dlg = MessageDialog()
82+
dlg.setTitle(QCoreApplication.translate('Postprocessing', 'Problem loading output layers'))
83+
dlg.setMessage(alg.getPostProcessingErrorMessage(wrongLayers))
7884
dlg.exec_()
7985

8086
if showResults and htmlResults and not wrongLayers:

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from processing.core.ProcessingLog import ProcessingLog
3535
from processing.core.ProcessingConfig import ProcessingConfig
3636
from processing.core.GeoAlgorithm import GeoAlgorithm
37-
from processing.gui.MissingDependencyDialog import MissingDependencyDialog
37+
from processing.gui.MessageDialog import MessageDialog
3838
from processing.gui.AlgorithmClassification import AlgorithmDecorator
3939
from processing.gui.ParametersDialog import ParametersDialog
4040
from processing.gui.BatchProcessingDialog import BatchProcessingDialog
@@ -186,7 +186,11 @@ def executeAlgorithm(self):
186186
alg = Processing.getAlgorithm(item.alg.commandLineName())
187187
message = alg.checkBeforeOpeningParametersDialog()
188188
if message:
189-
dlg = MissingDependencyDialog(message)
189+
dlg = MessageDialog()
190+
dlg.setTitle(self.tr('Missing dependency'))
191+
dlg.setMessage(
192+
self.tr('<h3>Missing dependency. This algorithm cannot '
193+
'be run :-( </h3>\n%s') % message)
190194
dlg.exec_()
191195
return
192196
alg = alg.getCopy()
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>Dialog</class>
4+
<widget class="QDialog" name="Dialog">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>457</width>
10+
<height>242</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Dialog</string>
15+
</property>
16+
<layout class="QVBoxLayout" name="verticalLayout">
17+
<item>
18+
<widget class="QTextBrowser" name="txtMessage">
19+
<property name="openLinks">
20+
<bool>false</bool>
21+
</property>
22+
</widget>
23+
</item>
24+
<item>
25+
<widget class="QDialogButtonBox" name="buttonBox">
26+
<property name="orientation">
27+
<enum>Qt::Horizontal</enum>
28+
</property>
29+
<property name="standardButtons">
30+
<set>QDialogButtonBox::Close</set>
31+
</property>
32+
</widget>
33+
</item>
34+
</layout>
35+
</widget>
36+
<resources/>
37+
<connections>
38+
<connection>
39+
<sender>buttonBox</sender>
40+
<signal>accepted()</signal>
41+
<receiver>Dialog</receiver>
42+
<slot>accept()</slot>
43+
<hints>
44+
<hint type="sourcelabel">
45+
<x>248</x>
46+
<y>254</y>
47+
</hint>
48+
<hint type="destinationlabel">
49+
<x>157</x>
50+
<y>274</y>
51+
</hint>
52+
</hints>
53+
</connection>
54+
<connection>
55+
<sender>buttonBox</sender>
56+
<signal>rejected()</signal>
57+
<receiver>Dialog</receiver>
58+
<slot>reject()</slot>
59+
<hints>
60+
<hint type="sourcelabel">
61+
<x>316</x>
62+
<y>260</y>
63+
</hint>
64+
<hint type="destinationlabel">
65+
<x>286</x>
66+
<y>274</y>
67+
</hint>
68+
</hints>
69+
</connection>
70+
</connections>
71+
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.