diff --git a/holoviews/plotting/bokeh/widgets.py b/holoviews/plotting/bokeh/widgets.py index 3491ce8c16..949cab6d0e 100644 --- a/holoviews/plotting/bokeh/widgets.py +++ b/holoviews/plotting/bokeh/widgets.py @@ -68,7 +68,7 @@ def __init__(self, plot, renderer=None, **params): self.renderer = renderer # Create mock NdMapping to hold the common dimensions and keys self.mock_obj = NdMapping([(k, None) for k in self.keys], - kdims=self.dimensions) + kdims=list(self.dimensions)) self.widgets, self.lookups = self.get_widgets() self.reverse_lookups = {d: {v: k for k, v in item.items()} for d, item in self.lookups.items()} @@ -195,11 +195,10 @@ def update(self): Handle update events on bokeh server. """ if not self._queue: - self._active = False return - self._queue = [] dim, widget_type, attr, old, new = self._queue[-1] + self._queue = [] dim_label = dim.pprint_label label, widget = self.widgets[dim_label] @@ -232,6 +231,7 @@ def update(self): key = wrap_tuple_streams(tuple(key), self.plot.dimensions, self.plot.streams) self.plot.update(key) + self._active = False diff --git a/tests/testbokehwidgets.py b/tests/testbokehwidgets.py index 07cbd695d9..6fdc33047e 100644 --- a/tests/testbokehwidgets.py +++ b/tests/testbokehwidgets.py @@ -2,7 +2,9 @@ import numpy as np -from holoviews.core import Dimension, NdMapping +from holoviews import renderer +from holoviews.core import Dimension, NdMapping, DynamicMap +from holoviews.element import Curve from holoviews.element.comparison import ComparisonTestCase try: @@ -18,6 +20,17 @@ def setUp(self): if not BokehServerWidgets: raise SkipTest("Bokeh required to test BokehServerWidgets") + def test_bokeh_widgets_server_mode(self): + dmap = DynamicMap(lambda X: Curve([]), kdims=['X']).redim.range(X=(0, 5)) + widgets = renderer('bokeh').instance(mode='server').get_widget(dmap, None) + div, widget = widgets.widgets['X'] + self.assertIsInstance(widget, Slider) + self.assertEqual(widget.value, 0) + self.assertEqual(widget.start, 0) + self.assertEqual(widget.end, 5) + self.assertEqual(widget.step, 1) + self.assertEqual(widgets.state.sizing_mode, 'fixed') + def test_bokeh_server_dynamic_range_int(self): dim = Dimension('x', range=(3, 11)) widget, label, mapping = BokehServerWidgets.create_widget(dim, editable=True)