Skip to content

Commit

Permalink
[processing] Fix exception when showing advanced parameters for alg i…
Browse files Browse the repository at this point in the history
…n modeler
  • Loading branch information
nyalldawson committed Sep 11, 2018
1 parent c8abd40 commit 90dbf72
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions python/plugins/processing/modeler/ModelerParametersDialog.py
Expand Up @@ -64,6 +64,7 @@
from processing.gui.wrappers import InvalidParameterValue
from processing.gui.MultipleInputPanel import MultipleInputPanel
from processing.tools.dataobjects import createContext
from processing.gui.wrappers import WidgetWrapper


class ModelerParametersDialog(QDialog):
Expand All @@ -78,6 +79,8 @@ def __init__(self, alg, model, algName=None, configuration=None):
self.configuration = configuration
self.context = createContext()

self.widget_labels = {}

self.setupUi()
self.params = None
settings = QgsSettings()
Expand Down Expand Up @@ -159,6 +162,7 @@ def setupUi(self):
tooltip = param.description()
widget.setToolTip(tooltip)
label = wrapper.label
self.widget_labels[param.name()] = label

if param.flags() & QgsProcessingParameterDefinition.FlagAdvanced:
label.setVisible(self.showAdvanced)
Expand Down Expand Up @@ -231,8 +235,13 @@ def showAdvancedParametersClicked(self):
self.advancedButton.setText(self.tr('Show advanced parameters'))
for param in self._alg.parameterDefinitions():
if param.flags() & QgsProcessingParameterDefinition.FlagAdvanced:
self.wrappers[param.name()].widget.setVisible(self.showAdvanced)
self.wrappers[param.name()].label.setVisible(self.showAdvanced)
wrapper = self.wrappers[param.name()]
if issubclass(wrapper.__class__, QgsProcessingModelerParameterWidget):
wrapper.setVisible(self.showAdvanced)
else:
wrapper.widget.setVisible(self.showAdvanced)

self.widget_labels[param.name()].setVisible(self.showAdvanced)

def getAvailableValuesOfType(self, paramType, outTypes=[], dataTypes=[]):
# upgrade paramType to list
Expand Down

0 comments on commit 90dbf72

Please sign in to comment.