Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed fixes #677

Merged
merged 2 commits into from
Oct 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions panel/io/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import textwrap

from bokeh.document import Document
from bokeh.document.events import ColumnDataChangedEvent
from bokeh.models import Model, Box
from bokeh.protocol import Protocol

Expand All @@ -24,6 +25,14 @@ def diff(doc, binary=True, events=None):
events = list(doc._held_events) if events is None else events
if not events or state._hold:
return None

# Filter ColumnDataChangedEvents which reference non-existing
# columns, later event will include the changes
fixed_events = []
for e in events:
if isinstance(e.hint, ColumnDataChangedEvent) and e.hint.cols is not None:
e.hint.cols = None
fixed_events.append(e)
msg = Protocol("1.0").create("PATCH-DOC", events, use_buffers=binary)
doc._held_events = [e for e in doc._held_events if e not in events]
return msg
Expand Down
23 changes: 23 additions & 0 deletions panel/widgets/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ class MultiSelect(Select):

_widget_type = _BkMultiSelect

_supports_embed = False

def _process_param_change(self, msg):
msg = super(Select, self)._process_param_change(msg)
labels, values = self.labels, self.values
Expand All @@ -132,6 +134,7 @@ def _process_property_change(self, msg):
return msg



class AutocompleteInput(Widget):

options = param.List(default=[])
Expand All @@ -145,8 +148,11 @@ class AutocompleteInput(Widget):
_rename = {'name': 'title', 'options': 'completions'}



class _RadioGroupBase(Select):

_supports_embed = False

__abstract = True

def _process_param_change(self, msg):
Expand Down Expand Up @@ -179,27 +185,40 @@ def _process_property_change(self, msg):
msg['value'] = list(self.values)[index]
return msg

def _get_embed_state(self, root, max_opts=3):
return (self, self._models[root.ref['id']][0], self.values,
lambda x: x.active, 'active', 'cb_obj.active')



class RadioButtonGroup(_RadioGroupBase, _ButtonBase):

_widget_type = _BkRadioButtonGroup

_rename = {'name': 'title'}

_supports_embed = True



class RadioBoxGroup(_RadioGroupBase):

inline = param.Boolean(default=False, doc="""
Whether the items be arrange vertically (``False``) or
horizontally in-line (``True``).""")

_supports_embed = True

_widget_type = _BkRadioBoxGroup



class _CheckGroupBase(Select):

value = param.List(default=[])

_supports_embed = False

__abstract = True

def _process_param_change(self, msg):
Expand All @@ -223,13 +242,15 @@ def _process_property_change(self, msg):
return msg



class CheckButtonGroup(_CheckGroupBase, _ButtonBase):

_widget_type = _BkCheckboxButtonGroup

_rename = {'name': 'title'}



class CheckBoxGroup(_CheckGroupBase):

inline = param.Boolean(default=False, doc="""
Expand All @@ -239,6 +260,7 @@ class CheckBoxGroup(_CheckGroupBase):
_widget_type = _BkCheckboxGroup



class ToggleGroup(Select):
"""This class is a factory of ToggleGroup widgets.

Expand Down Expand Up @@ -281,6 +303,7 @@ def __new__(cls, widget_type='button', behavior='check', **params):
return RadioBoxGroup(**params)



class CrossSelector(CompositeWidget, MultiSelect):
"""
A composite widget which allows selecting from a list of items
Expand Down