[processing] Fix exception on launching refactor fields

(The logic with parameter widget_wrapper metadata is very gross -
but there's nothing we can do about it till 4.0!)

Fixes #20707
This commit is contained in:
Nyall Dawson 2018-12-04 08:53:55 +10:00
parent 0ba37fcb72
commit 9c1653f00a

View File

@ -1772,8 +1772,11 @@ class WidgetWrapperFactory:
@staticmethod
def create_wrapper(param, dialog, row=0, col=0):
if param.metadata().get('widget_wrapper', {}).get('class', None) is not None:
wrapper_metadata = param.metadata().get('widget_wrapper', None)
# VERY messy logic here to avoid breaking 3.0 API which allowed metadata "widget_wrapper" value to be either
# a string name of a class OR a dict.
# TODO QGIS 4.0 -- require widget_wrapper to be a dict.
if wrapper_metadata and (not isinstance(wrapper_metadata, dict) or wrapper_metadata.get('class', None) is not None):
return WidgetWrapperFactory.create_wrapper_from_metadata(param, dialog, row, col)
else:
# try from c++ registry first