Commit b98fda42 authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

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): ...@@ -50,15 +50,35 @@ class OTBChoiceWidgetWrapper(WidgetWrapper):
def setWrapperVisible(self, name, visible): def setWrapperVisible(self, name, visible):
if self.dialogType == DIALOG_STANDARD: if self.dialogType == DIALOG_STANDARD:
if self.dialog.mainWidget() is None: if self.dialog.mainWidget() is None:
return return
self.dialog.mainWidget().wrappers[name].widget.setVisible(visible) # For compatibility with 3.x API, we need to check whether the wrapper is
if self.dialog.mainWidget().wrappers[name].label: # the deprecated WidgetWrapper class. If not, it's the newer
self.dialog.mainWidget().wrappers[name].label.setVisible(visible) # 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: 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: if name in self.dialog.wrappers:
self.dialog.wrappers[name].widget.setVisible(visible) is_python_wrapper = issubclass(self.dialog.wrappers[name].__class__, WidgetWrapper)
if self.dialog.wrappers[name].label: if is_python_wrapper:
self.dialog.wrappers[name].label.setVisible(visible) 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): def valueChanged(self, value):
for parameter in self.get_algorithm().parameterDefinitions(): for parameter in self.get_algorithm().parameterDefinitions():
...@@ -88,10 +108,20 @@ class OTBChoiceWidgetWrapper(WidgetWrapper): ...@@ -88,10 +108,20 @@ class OTBChoiceWidgetWrapper(WidgetWrapper):
name = parameter.name() name = parameter.name()
v = self.value() == parameter.metadata()['group_value'] v = self.value() == parameter.metadata()['group_value']
for wrapper in wrappers: 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: if wrapper.param.name() == name:
wrapper.widget.setVisible(v) if is_python_wrapper:
if wrapper.label: wrapper.widget.setVisible(v)
wrapper.label.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 from qgis.core import QgsProcessingParameterDefinition
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
[general] [general]
name=Orfeo ToolBox (OTB) name=Orfeo ToolBox (OTB)
qgisMinimumVersion=3.1 qgisMinimumVersion=3.4
description=Open Source processing of remote sensing images description=Open Source processing of remote sensing images
version=0.1 version=0.1
author=C-S, CNES 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