Skip to content

Commit

Permalink
[processing] Fix exception on launching refactor fields
Browse files Browse the repository at this point in the history
(The logic with parameter widget_wrapper metadata is very gross -
but there's nothing we can do about it till 4.0!)

Fixes #20707

(cherry picked from commit a947bbf)
  • Loading branch information
nyalldawson committed Dec 4, 2018
1 parent 0c36b90 commit 039a6c5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions python/plugins/processing/gui/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 039a6c5

Please sign in to comment.