Add some notes on deprecated class handling

This commit is contained in:
Nyall Dawson 2018-09-04 15:25:07 +10:00
parent e76b761dd0
commit 3c2499ba95
3 changed files with 13 additions and 0 deletions

View File

@ -104,6 +104,10 @@ class AlgorithmDialog(QgsProcessingAlgorithmDialogBase):
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:

View File

@ -234,6 +234,10 @@ class BatchPanel(BASE, WIDGET):
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)

View File

@ -131,6 +131,11 @@ class ParametersPanel(BASE, WIDGET):
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)