Commit b98fda42 authored by Rashad Kanavath's avatar Rashad Kanavath

upgrade to QGIS 3.4

This commit includes fixes fora half way refactoring of qgis processing
api which is going to remove WidgetWrapper class but not yet.
parent 69c27eba
......@@ -50,15 +50,35 @@ class OTBChoiceWidgetWrapper(WidgetWrapper):
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)
return
# For compatibility with 3.x API, we need to check whether the wrapper is
# the deprecated WidgetWrapper class. If not, it's the newer
# QgsAbstractProcessingParameterWidgetWrapper class
# TODO QGIS 4.0 - remove is_python_wrapper logic
is_python_wrapper = issubclass(self.dialog.mainWidget().wrappers[name].__class__, WidgetWrapper)
if is_python_wrapper:
self.dialog.mainWidget().wrappers[name].widget.setVisible(visible)
if self.dialog.mainWidget().wrappers[name].label:
self.dialog.mainWidget().wrappers[name].label.setVisible(visible)
else:
self.dialog.mainWidget().wrappers[name].wrappedWidget().setVisible(visible)
if self.dialog.mainWidget().wrappers[name].wrappedLabel():
self.dialog.mainWidget().wrappers[name].wrappedLabel().setVisible(visible)
else:
# For compatibility with 3.x API, we need to check whether the wrapper is
# the deprecated WidgetWrapper class. If not, it's the newer
# QgsAbstractProcessingParameterWidgetWrapper class
# TODO QGIS 4.0 - remove is_python_wrapper logic
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)
is_python_wrapper = issubclass(self.dialog.wrappers[name].__class__, WidgetWrapper)
if is_python_wrapper:
self.dialog.wrappers[name].widget.setVisible(visible)
if self.dialog.wrappers[name].label:
self.dialog.wrappers[name].label.setVisible(visible)
else:
self.dialog.wrappers[name].setVisible(visible)
if name in self.dialog.widget_labels:
self.dialog.widget_labels[name].setVisible(visible)
def valueChanged(self, value):
for parameter in self.get_algorithm().parameterDefinitions():
......@@ -88,10 +108,20 @@ class OTBChoiceWidgetWrapper(WidgetWrapper):
name = parameter.name()
v = self.value() == parameter.metadata()['group_value']
for wrapper in wrappers:
# For compatibility with 3.x API, we need to check whether the wrapper is
# the deprecated WidgetWrapper class. If not, it's the newer
# QgsAbstractProcessingParameterWidgetWrapper class
# TODO QGIS 4.0 - remove is_python_wrapper logic
is_python_wrapper = issubclass(wrapper.__class__, WidgetWrapper)
if wrapper.param.name() == name:
wrapper.widget.setVisible(v)
if wrapper.label:
wrapper.label.setVisible(v)
if is_python_wrapper:
wrapper.widget.setVisible(v)
if wrapper.label:
wrapper.label.setVisible(v)
else:
wrapper.wrappedWidget().setVisible(v)
if wrapper.wrappedLabel():
wrapper.wrappedLabel().setVisible(v)
from qgis.core import QgsProcessingParameterDefinition
......
......@@ -8,7 +8,7 @@
[general]
name=Orfeo ToolBox (OTB)
qgisMinimumVersion=3.1
qgisMinimumVersion=3.4
description=Open Source processing of remote sensing images
version=0.1
author=C-S, CNES
......
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