Skip to content

Commit

Permalink
SimpleDomainContextHandler does not subclass DomainContextHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
markotoplak committed Aug 5, 2024
1 parent 761506b commit f18722e
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions Orange/widgets/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 328 in Orange/widgets/settings.py

View check run for this annotation

Codecov / codecov/patch

Orange/widgets/settings.py#L328

Added line #L328 was not covered by tests
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)

Check warning on line 334 in Orange/widgets/settings.py

View check run for this annotation

Codecov / codecov/patch

Orange/widgets/settings.py#L334

Added line #L334 was not covered by tests

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)
Expand Down

0 comments on commit f18722e

Please sign in to comment.