From 2ad27b172ea12add240bc256a1f183b0c71e2e70 Mon Sep 17 00:00:00 2001 From: "arnaud.morvan@camptocamp.com" Date: Tue, 23 Aug 2016 10:44:57 +0200 Subject: [PATCH] Add metadata property to parameters --- python/plugins/processing/core/parameters.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/plugins/processing/core/parameters.py b/python/plugins/processing/core/parameters.py index ab84ef589ae..f0620565163 100644 --- a/python/plugins/processing/core/parameters.py +++ b/python/plugins/processing/core/parameters.py @@ -58,7 +58,10 @@ class Parameter(object): take as input. """ - def __init__(self, name='', description='', default=None, optional=False): + default_metadata = {} + + def __init__(self, name='', description='', default=None, optional=False, + metadata={}): self.name = name self.description = description self.default = default @@ -73,6 +76,10 @@ class Parameter(object): self.optional = parseBool(optional) + # TODO: make deep copy and deep update + self.metadata = self.default_metadata.copy() + self.metadata.update(metadata) + def setValue(self, obj): """ Sets the value of the parameter.