Commit 5b5a1f15 authored by Rashad Kanavath's avatar Rashad Kanavath

pending qgis PR6739

parent 3f4f251a
......@@ -41,10 +41,17 @@ class OTBChoiceWidgetWrapper(WidgetWrapper):
widget.currentIndexChanged.connect(self.valueChanged)
return widget
def get_algorithm(self):
if self.dialogType == DIALOG_MODELER:
return self.dialog._alg
else:
return self.dialog.algorithm()
def valueChanged(self, value):
if self.dialog.mainWidget() is None:
return
for parameter in self.dialog.algorithm().parameterDefinitions():
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()
......@@ -67,12 +74,12 @@ class OTBChoiceWidgetWrapper(WidgetWrapper):
def value(self):
return self.widget.currentText()
def postInitialize(self, wrappers):
if self.dialogType == DIALOG_BATCH:
return
for parameter in self.dialog.algorithm().parameterDefinitions():
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()
......@@ -83,7 +90,6 @@ class OTBChoiceWidgetWrapper(WidgetWrapper):
if wrapper.label:
wrapper.label.setVisible(v)
from qgis.core import QgsProcessingParameterDefinition
class OTBParameterChoice(QgsProcessingParameterDefinition):
......@@ -115,14 +121,3 @@ class OTBParameterChoice(QgsProcessingParameterDefinition):
def type(self):
return 'OTBParameterChoice'
# def wrapper(self, dialog, row=0, col=0):
# wrapper = self.metadata.get('widget_wrapper', None)
# # wrapper metadata should be a class path
# if isinstance(wrapper, str):
# wrapper = OTBChoiceWidgetWrapper
# # or directly a class object
# from inspect import isclass
# if isclass(wrapper):
# wrapper = wrapper(self, dialog, row, col)
# # or a wrapper instance
# return wrapper
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