Skip to content
Permalink
Browse files

[processing] added missing validators for param values in modeler

  • Loading branch information
volaya committed Oct 5, 2016
1 parent 4751b70 commit e1072e9718d2e2ea408d8773fe4c02286b26ca74
Showing with 16 additions and 9 deletions.
  1. +16 −9 python/plugins/processing/gui/wrappers.py
@@ -501,7 +501,7 @@ def setValue(self, value):
if self.dialogType == DIALOG_STANDARD:
pass # TODO
elif self.dialogType == DIALOG_BATCH:
return self.widget.setText(value)
self.widget.setText(value)
else:
self.setComboValue(value)

@@ -511,7 +511,9 @@ def value(self):
elif self.dialogType == DIALOG_BATCH:
return self.widget.getText()
else:
return self.comboValue()
def validator(v):
return bool(v) or self.param.optional
return self.comboValue(validator)


class SelectionWidgetWrapper(WidgetWrapper):
@@ -568,7 +570,7 @@ def setValue(self, value):
if self.dialogType == DIALOG_STANDARD:
pass # TODO
elif self.dialogType == DIALOG_BATCH:
return self.widget.setText(value)
self.widget.setText(value)
else:
self.setComboValue(value)

@@ -582,7 +584,9 @@ def value(self):
elif self.dialogType == DIALOG_BATCH:
return self.widget.getText()
else:
return self.comboValue()
def validator(v):
return bool(v) or self.param.optional
return self.comboValue(validator)

class StringWidgetWrapper(WidgetWrapper):

@@ -702,9 +706,10 @@ def value(self):
elif self.dialogType == DIALOG_BATCH:
return self.widget.getText()
else:
return self.comboValue()


def validator(v):
return bool(v) or self.param.optional
return self.comboValue(validator)

class TableFieldWidgetWrapper(WidgetWrapper):

NOT_SET = '[Not set]'
@@ -801,8 +806,10 @@ def value(self):
elif self.dialogType == DIALOG_BATCH:
return self.widget.text()
else:
return self.comboValue()

def validator(v):
return bool(v) or self.param.optional
return self.comboValue(validator)

def anotherParameterWidgetHasChanged(self,wrapper):
if wrapper.param.name == self.param.parent:
layer = wrapper.value()

0 comments on commit e1072e9

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