17
17
***************************************************************************
18
18
"""
19
19
20
+
20
21
__author__ = 'Victor Olaya'
21
22
__date__ = 'August 2012'
22
23
__copyright__ = '(C) 2012, Victor Olaya'
29
30
from qgis .PyQt .QtWidgets import (QDialog , QDialogButtonBox , QLabel , QLineEdit ,
30
31
QFrame , QPushButton , QSizePolicy , QVBoxLayout ,
31
32
QHBoxLayout , QTabWidget , QWidget , QScrollArea ,
32
- QComboBox , QTableWidgetItem , QMessageBox )
33
+ QComboBox , QTableWidgetItem , QMessageBox ,
34
+ QTextBrowser )
33
35
from qgis .PyQt .QtNetwork import QNetworkRequest , QNetworkReply
34
36
35
37
from qgis .core import QgsNetworkAccessManager
36
38
39
+ from qgis .gui import QgsMessageBar
40
+
37
41
from processing .gui .CrsSelectionPanel import CrsSelectionPanel
38
42
from processing .gui .MultipleInputPanel import MultipleInputPanel
39
43
from processing .gui .FixedTablePanel import FixedTablePanel
@@ -82,13 +86,13 @@ class ModelerParametersDialog(QDialog):
82
86
def __init__ (self , alg , model , algName = None ):
83
87
QDialog .__init__ (self )
84
88
self .setModal (True )
85
- #The algorithm to define in this dialog. It is an instance of GeoAlgorithm
89
+ # The algorithm to define in this dialog. It is an instance of GeoAlgorithm
86
90
self ._alg = alg
87
- #The resulting algorithm after the user clicks on OK. it is an instance of the container Algorithm class
91
+ # The resulting algorithm after the user clicks on OK. it is an instance of the container Algorithm class
88
92
self .alg = None
89
- #The model this algorithm is going to be added to
93
+ # The model this algorithm is going to be added to
90
94
self .model = model
91
- #The name of the algorithm in the model, in case we are editing it and not defining it for the first time
95
+ # The name of the algorithm in the model, in case we are editing it and not defining it for the first time
92
96
self ._algName = algName
93
97
self .setupUi ()
94
98
self .params = None
@@ -112,6 +116,10 @@ def setupUi(self):
112
116
self .verticalLayout .setSpacing (5 )
113
117
self .verticalLayout .setMargin (20 )
114
118
119
+ self .bar = QgsMessageBar ()
120
+ self .bar .setSizePolicy (QSizePolicy .Minimum , QSizePolicy .Fixed )
121
+ self .verticalLayout .addWidget (self .bar )
122
+
115
123
hLayout = QHBoxLayout ()
116
124
hLayout .setSpacing (5 )
117
125
hLayout .setMargin (0 )
@@ -203,7 +211,6 @@ def setupUi(self):
203
211
self .txtHelp = QTextBrowser ()
204
212
205
213
html = None
206
- url = None
207
214
isText , algHelp = self ._alg .help ()
208
215
if algHelp is not None :
209
216
algHelp = algHelp if isText else QUrl (algHelp )
@@ -526,6 +533,8 @@ def createAlgorithm(self):
526
533
if param .hidden :
527
534
continue
528
535
if not self .setParamValue (alg , param , self .valueItems [param .name ]):
536
+ self .bar .pushMessage ("Error" , "Wrong or missing value for parameter '%s'" % param .description ,
537
+ level = QgsMessageBar .WARNING )
529
538
return None
530
539
for output in outputs :
531
540
if not output .hidden :
@@ -732,9 +741,7 @@ def okPressed(self):
732
741
self .alg = self .createAlgorithm ()
733
742
if self .alg is not None :
734
743
self .close ()
735
- else :
736
- QMessageBox .warning (self , self .tr ('Unable to add algorithm' ),
737
- self .tr ('Wrong or missing parameter values' ))
744
+
738
745
739
746
def cancelPressed (self ):
740
747
self .alg = None
0 commit comments