diff --git a/Orange/widgets/settings.py b/Orange/widgets/settings.py index fdc9066e98e..1e8bcd25ffd 100644 --- a/Orange/widgets/settings.py +++ b/Orange/widgets/settings.py @@ -317,12 +317,29 @@ def match(self, context, domain, attrs, metas): return StructuredVariableSettingMixin.match(self, context, attrs, metas) -class SimpleDomainContextHandler(DomainContextHandler): +class SimpleDomainContextHandler(ContextHandler, StructuredVariableSettingMixin, + VariableEncoderMixin): + def __init__(self): + super().__init__() + self.first_match = True - def encode_domain(self, domain): - return tuple() + def open_context(self, widget, domain): + if domain is None: + return + if not isinstance(domain, Domain): + domain = domain.domain + super().open_context(widget, domain) + + def filter_value(self, setting, data, domain, *args): + StructuredVariableSettingMixin.filter_value(self, setting, data, *args) + + def encode_setting(self, context, setting, value): + return StructuredVariableSettingMixin.encode_setting( + self, context, setting, value) - new_context = ContextHandler.new_context + def decode_setting(self, setting, value, domain, *args): + return StructuredVariableSettingMixin.decode_setting( + self, setting, value, domain, *args) def match_variable(self, setting, value, domain): assert isinstance(setting, ContextSetting)