Skip to content

Commit

Permalink
ContextHandlers: Add is_allowed_type
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed May 2, 2020
1 parent cf0f69f commit 5dd4b44
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Orange/widgets/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import itertools
import logging
import warnings
from typing import List

from orangewidget.settings import (
Setting, SettingProvider, SettingsHandler, ContextSetting,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 5dd4b44

Please sign in to comment.