Skip to content
Permalink
Browse files

Add some notes on deprecated class handling

  • Loading branch information
nyalldawson committed Sep 4, 2018
1 parent e76b761 commit 3c2499ba95c6ca97c3caf0d13f3edbf9123b3a59
@@ -104,6 +104,10 @@ def getParameterValues(self):
except KeyError:
continue

# 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
if issubclass(wrapper.__class__, WidgetWrapper):
widget = wrapper.widget
else:
@@ -234,6 +234,10 @@ def save(self):
def setCellWrapper(self, row, column, wrapper, context):
self.wrappers[row][column] = wrapper

# 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_cpp_wrapper = not issubclass(wrapper.__class__, WidgetWrapper)
if is_cpp_wrapper:
widget = wrapper.createWrappedWidget(context)
@@ -131,6 +131,11 @@ def initWidgets(self):
else:
wrapper = WidgetWrapperFactory.create_wrapper(param, self.parent)
self.wrappers[param.name()] = wrapper

# 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 = issubclass(wrapper.__class__, WidgetWrapper)
if not is_python_wrapper:
widget = wrapper.createWrappedWidget(self.processing_context)

0 comments on commit 3c2499b

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