Skip to content
Permalink
Browse files

[processing] fixes and better warning messages in modeler

  • Loading branch information
volaya committed May 31, 2016
1 parent 797826e commit 5773d0d51bd1f9b569b7d8394874f4a7aff77435
Showing with 16 additions and 9 deletions.
  1. +16 −9 python/plugins/processing/modeler/ModelerParametersDialog.py
@@ -17,6 +17,7 @@
***************************************************************************
"""


__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
@@ -29,11 +30,14 @@
from qgis.PyQt.QtWidgets import (QDialog, QDialogButtonBox, QLabel, QLineEdit,
QFrame, QPushButton, QSizePolicy, QVBoxLayout,
QHBoxLayout, QTabWidget, QWidget, QScrollArea,
QComboBox, QTableWidgetItem, QMessageBox)
QComboBox, QTableWidgetItem, QMessageBox,
QTextBrowser)
from qgis.PyQt.QtNetwork import QNetworkRequest, QNetworkReply

from qgis.core import QgsNetworkAccessManager

from qgis.gui import QgsMessageBar

from processing.gui.CrsSelectionPanel import CrsSelectionPanel
from processing.gui.MultipleInputPanel import MultipleInputPanel
from processing.gui.FixedTablePanel import FixedTablePanel
@@ -82,13 +86,13 @@ class ModelerParametersDialog(QDialog):
def __init__(self, alg, model, algName=None):
QDialog.__init__(self)
self.setModal(True)
#The algorithm to define in this dialog. It is an instance of GeoAlgorithm
# The algorithm to define in this dialog. It is an instance of GeoAlgorithm
self._alg = alg
#The resulting algorithm after the user clicks on OK. it is an instance of the container Algorithm class
# The resulting algorithm after the user clicks on OK. it is an instance of the container Algorithm class
self.alg = None
#The model this algorithm is going to be added to
# The model this algorithm is going to be added to
self.model = model
#The name of the algorithm in the model, in case we are editing it and not defining it for the first time
# The name of the algorithm in the model, in case we are editing it and not defining it for the first time
self._algName = algName
self.setupUi()
self.params = None
@@ -112,6 +116,10 @@ def setupUi(self):
self.verticalLayout.setSpacing(5)
self.verticalLayout.setMargin(20)

self.bar = QgsMessageBar()
self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
self.verticalLayout.addWidget(self.bar)

hLayout = QHBoxLayout()
hLayout.setSpacing(5)
hLayout.setMargin(0)
@@ -203,7 +211,6 @@ def setupUi(self):
self.txtHelp = QTextBrowser()

html = None
url = None
isText, algHelp = self._alg.help()
if algHelp is not None:
algHelp = algHelp if isText else QUrl(algHelp)
@@ -526,6 +533,8 @@ def createAlgorithm(self):
if param.hidden:
continue
if not self.setParamValue(alg, param, self.valueItems[param.name]):
self.bar.pushMessage("Error", "Wrong or missing value for parameter '%s'" % param.description,
level=QgsMessageBar.WARNING)
return None
for output in outputs:
if not output.hidden:
@@ -732,9 +741,7 @@ def okPressed(self):
self.alg = self.createAlgorithm()
if self.alg is not None:
self.close()
else:
QMessageBox.warning(self, self.tr('Unable to add algorithm'),
self.tr('Wrong or missing parameter values'))


def cancelPressed(self):
self.alg = None

0 comments on commit 5773d0d

Please sign in to comment.
You can’t perform that action at this time.