Skip to content
Permalink
Browse files

Merge pull request #6755 from m-kuhn/minimal_processing_fixes

Some fixes for processing
  • Loading branch information
m-kuhn committed Apr 9, 2018
2 parents f378a23 + 4a14a36 commit 5b7b7be6e7036209e11b5e54fb1010f177776e34
@@ -643,13 +643,7 @@ def addAlgorithm(self):
self._addAlgorithm(alg)

def _addAlgorithm(self, alg, pos=None):
dlg = None
try:
dlg = alg.getCustomModelerParametersDialog(self.model)
except:
pass
if not dlg:
dlg = ModelerParametersDialog(alg, self.model)
dlg = ModelerParametersDialog(alg, self.model)
if dlg.exec_():
alg = dlg.createAlgorithm()
if pos is None:
@@ -207,12 +207,8 @@ def editElement(self):
self.text = dlg.param.description()
self.scene.dialog.repaintModel()
elif isinstance(self.element, QgsProcessingModelChildAlgorithm):
dlg = None
elemAlg = self.element.algorithm()
if hasattr(elemAlg, 'getCustomModelerParametersDialog'):
dlg = elemAlg.getCustomModelerParametersDialog(self.model, self.element.childId())
if not dlg:
dlg = ModelerParametersDialog(elemAlg, self.model, self.element.childId())
dlg = ModelerParametersDialog(elemAlg, self.model, self.element.childId())
if dlg.exec_():
alg = dlg.createAlgorithm()
alg.setChildId(self.element.childId())
@@ -63,19 +63,14 @@


class ModelerParametersDialog(QDialog):
ENTER_NAME = '[Enter name if this is a final result]'
NOT_SELECTED = '[Not selected]'
USE_MIN_COVERING_EXTENT = '[Use min covering extent]'

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 QgsProcessingModelAlgorithm
self._alg = alg
# 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
self.childId = algName

self._alg = alg # The algorithm to define in this dialog. It is an instance of QgsProcessingAlgorithm
self.model = model # The model this algorithm is going to be added to. It is an instance of QgsProcessingModelAlgorithm
self.childId = algName # The name of the algorithm in the model, in case we are editing it and not defining it for the first time

self.setupUi()
self.params = None
settings = QgsSettings()
@@ -157,7 +152,7 @@ def setupUi(self):
label = QLabel(dest.description())
item = QgsFilterLineEdit()
if hasattr(item, 'setPlaceholderText'):
item.setPlaceholderText(ModelerParametersDialog.ENTER_NAME)
item.setPlaceholderText(self.tr('[Enter name if this is a final result]'))
self.verticalLayout.addWidget(label)
self.verticalLayout.addWidget(item)
self.valueItems[dest.name()] = item
@@ -319,8 +314,8 @@ def createAlgorithm(self):
outputs = {}
for dest in self._alg.destinationParameterDefinitions():
if not dest.flags() & QgsProcessingParameterDefinition.FlagHidden:
name = str(self.valueItems[dest.name()].text())
if name.strip() != '' and name != ModelerParametersDialog.ENTER_NAME:
name = self.valueItems[dest.name()].text()
if name.strip() != '':
output = QgsProcessingModelOutput(name, name)
output.setChildId(alg.childId())
output.setChildOutputName(dest.name())

0 comments on commit 5b7b7be

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