diff --git a/Orange/widgets/settings.py b/Orange/widgets/settings.py index 5c9d8d05d0e..c9f884f763b 100644 --- a/Orange/widgets/settings.py +++ b/Orange/widgets/settings.py @@ -33,6 +33,7 @@ import itertools import logging import warnings +from typing import List from orangewidget.settings import ( Setting, SettingProvider, SettingsHandler, ContextSetting, @@ -77,6 +78,11 @@ def __init__(self, *, match_values=0, first_match=True, **kwargs): .format(name), OrangeDeprecationWarning ) + @classmethod + def is_allowed_type(cls, setting): + return ContextHandler.is_allowed_type(setting) \ + or setting.type in (Variable, List[Variable]) + def encode_domain(self, domain): """ domain: Orange.data.domain to encode @@ -273,7 +279,7 @@ class ClassValuesContextHandler(ContextHandler): def open_context(self, widget, classes): if isinstance(classes, Variable): if classes.is_discrete: - classes = classes.values + classes = tuple(classes.values) else: classes = None @@ -281,7 +287,7 @@ def open_context(self, widget, classes): def new_context(self, classes): context = super().new_context() - context.classes = classes + context.classes = tuple(classes) return context def match(self, context, classes):