Commit 19037f7d authored by Rashad Kanavath's avatar Rashad Kanavath

fix valuechanged for OTBChoiceWidget

parent fce52241
......@@ -75,6 +75,7 @@ class OTBAlgorithm(QgsProcessingAlgorithm):
# return True, None
# TODO: check if this method is really required.
def checkParameterValues(self, parameters, context):
for key, value in parameters.items():
param = self.parameterDefinition(key)
......
......@@ -47,23 +47,26 @@ class OTBChoiceWidgetWrapper(WidgetWrapper):
else:
return self.dialog.algorithm()
def valueChanged(self, value):
if self.dialog.mainWidget() is None:
return
def setWrapperVisible(self, name, visible):
if self.dialogType == DIALOG_STANDARD:
if self.dialog.mainWidget() is None:
return
self.dialog.mainWidget().wrappers[name].widget.setVisible(visible)
if self.dialog.mainWidget().wrappers[name].label:
self.dialog.mainWidget().wrappers[name].label.setVisible(visible)
else:
if name in self.dialog.wrappers:
self.dialog.wrappers[name].widget.setVisible(visible)
if self.dialog.wrappers[name].label:
self.dialog.wrappers[name].label.setVisible(visible)
def valueChanged(self, value):
for parameter in self.get_algorithm().parameterDefinitions():
if not 'group_key' in parameter.metadata() or parameter.metadata()['group_key'] != self.param.name():
continue
name = parameter.name()
v = self.value() == parameter.metadata()['group_value']
if self.dialogType == DIALOG_STANDARD:
self.dialog.mainWidget().wrappers[name].widget.setVisible(v)
if self.dialog.mainWidget().wrappers[name].label:
self.dialog.mainWidget().wrappers[name].label.setVisible(v)
else:
self.dialog.wrappers[name].widget.setVisible(v)
if self.dialog.wrappers[name].label:
self.dialog.wrappers[name].label.setVisible(v)
self.setWrapperVisible(name, v)
def setValue(self, value):
if value in self.param.options:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment