Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ParameterMultipleInput minor fixes.
  • Loading branch information
sept-en committed Mar 22, 2016
1 parent 8c9eddc commit d5acc21
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions python/plugins/processing/core/parameters.py
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d5acc21

Please sign in to comment.