From 5dd4b44b75c2292e855430828e309164202a8646 Mon Sep 17 00:00:00 2001 From: janezd Date: Fri, 1 May 2020 19:35:24 +0200 Subject: [PATCH] ContextHandlers: Add is_allowed_type --- Orange/widgets/settings.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Orange/widgets/settings.py b/Orange/widgets/settings.py index 5c9d8d05d0e..d24960b58ce 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 @@ -276,7 +282,8 @@ def open_context(self, widget, classes): classes = classes.values else: classes = None - + if classes is not None: + classes = tuple(classes) super().open_context(widget, classes) def new_context(self, classes):