Skip to content
Permalink
Browse files

Some fixes to processing expression parameters

  • Loading branch information
nyalldawson committed Nov 11, 2016
1 parent a4cc572 commit 28d7ceaef5546415e2e359202fef00cbc07ed3d0
Showing with 11 additions and 7 deletions.
  1. +7 −6 python/plugins/processing/core/parameters.py
  2. +4 −1 python/plugins/processing/gui/wrappers.py
@@ -1251,12 +1251,13 @@ def getAsScriptCode(self):
@classmethod
def fromScriptCode(self, line):
isOptional, name, definition = _splitParameterOptions(line)
descName = _createDescriptiveName(name)
default = definition.strip()[len('expression') + 1:]
if default:
return ParameterExpression(name, descName, default, optional=isOptional)
else:
return ParameterExpression(name, descName, optional=isOptional)
if definition.lower().strip().startswith('expression'):
descName = _createDescriptiveName(name)
default = definition.strip()[len('expression') + 1:]
if default:
return ParameterExpression(name, descName, default, optional=isOptional)
else:
return ParameterExpression(name, descName, optional=isOptional)


class ParameterTable(ParameterDataObject):
@@ -754,7 +754,10 @@ def setValue(self, value):

def value(self):
if self.dialogType in (DIALOG_STANDARD, DIALOG_BATCH):
return self.widget.asExpression()
try:
return self.widget.asExpression()
except:
return self.widget.expression()
else:
def validator(v):
return bool(v) or self.param.optional

0 comments on commit 28d7cea

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