Skip to content
Permalink
Browse files

Allow specifying hidden parameter values when setting initial paramet…

…er values for an algorithm dialog
  • Loading branch information
nyalldawson committed Apr 28, 2020
1 parent d0cff49 commit 69e841a2564d29f427ac88d9e9c4064eaa6c0e5b
Showing with 7 additions and 0 deletions.
  1. +7 −0 python/plugins/processing/gui/ParametersPanel.py
@@ -52,6 +52,8 @@ def __init__(self, parent, alg, in_place=False):

self.wrappers = {}

self.extra_parameters = {}

self.processing_context = createContext()

class ContextGenerator(QgsProcessingContextGenerator):
@@ -189,6 +191,8 @@ def initWidgets(self):

def createProcessingParameters(self):
parameters = {}
for p, v in self.extra_parameters.items():
parameters[p] = v

for param in self.algorithm().parameterDefinitions():
if param.flags() & QgsProcessingParameterDefinition.FlagHidden:
@@ -251,8 +255,11 @@ def createProcessingParameters(self):
return self.algorithm().preprocessParameters(parameters)

def setParameters(self, parameters):
self.extra_parameters = {}
for param in self.algorithm().parameterDefinitions():
if param.flags() & QgsProcessingParameterDefinition.FlagHidden:
if param.name() in parameters:
self.extra_parameters[param.name()] = parameters[param.name()]
continue

if not param.name() in parameters:

0 comments on commit 69e841a

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