Skip to content
Permalink
Browse files

ParameterMultipleInput minor fixes.

  • Loading branch information
sept-en committed Mar 22, 2016
1 parent 8c9eddc commit d5acc211c8915a2629ae0a059c4f12d97ce0c34a
Showing with 5 additions and 3 deletions.
  1. +5 −3 python/plugins/processing/core/parameters.py
@@ -341,7 +341,7 @@ def __init__(self, name='', description='', datatype=-1, optional=False):
ParameterDataObject.__init__(self, name, description, None, optional)
self.datatype = int(float(datatype))
self.exported = None
self.minNumInputs = 1
self.minNumInputs = 0

""" Set minimum required number of inputs for parameter
@@ -354,14 +354,15 @@ def __init__(self, name='', description='', datatype=-1, optional=False):
"""
def setMinNumInputs(self, _minNumInputs):
if _minNumInputs is None:
self.minNumInputs = 1
return
self.minNumInputs = 0
return True

if _minNumInputs < 1 and not self.optional:
# dont allow to set negative or null number of inputs if parameter isn't optional
return False

self.minNumInputs = int(minNumInputs)
return True

""" Get minimum required number of inputs for parameter
@@ -382,6 +383,7 @@ def setValue(self, obj):
if isinstance(obj, list):
if len(obj) == 0:
if self.optional:
self.value = None
return True
else:
return False

0 comments on commit d5acc21

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