From f84f1826c6e41a3f2ae1c0f773c9fdb57d820a37 Mon Sep 17 00:00:00 2001
From: Philipp Rudiger
Date: Fri, 23 Sep 2016 03:12:41 +0100
Subject: [PATCH] Fixed bokeh Callbacks
---
holoviews/plotting/bokeh/callbacks.py | 13 +++----------
holoviews/plotting/plot.py | 2 ++
2 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/holoviews/plotting/bokeh/callbacks.py b/holoviews/plotting/bokeh/callbacks.py
index 889f7d13ef..9b764e7a03 100644
--- a/holoviews/plotting/bokeh/callbacks.py
+++ b/holoviews/plotting/bokeh/callbacks.py
@@ -165,16 +165,9 @@ def serialize(self, models):
"""
Serializes any Bokeh plot objects passed to it as a list.
"""
- documents = {plot.document for plot in self.plots}
- for doc in documents:
- if hasattr(doc, 'last_comms_handle'):
- handle = doc.last_comms_handle
- else:
- handle = _CommsHandle(get_comms(doc.last_comms_target),
- doc, None)
- doc.last_comms_handle = handle
- msg = compute_static_patch(doc, models)
- handle.comms.send(serialize_json(msg))
+ for plot in self.plots:
+ msg = compute_static_patch(plot.document, models)
+ plot.comm.send(serialize_json(msg))
return 'Complete'
diff --git a/holoviews/plotting/plot.py b/holoviews/plotting/plot.py
index 4108e2de87..1e58f9e9e9 100644
--- a/holoviews/plotting/plot.py
+++ b/holoviews/plotting/plot.py
@@ -768,6 +768,7 @@ def __init__(self, overlay, ranges=None, batched=True, **params):
self.hmap = Compositor.collapse(self.hmap, None, mode='data')
self.hmap = self._apply_compositor(self.hmap, ranges, self.keys)
self.subplots = self._create_subplots(ranges)
+ self.traverse(lambda x: setattr(x, 'comm', self.comm))
def _apply_compositor(self, holomap, ranges=None, keys=None, dimensions=None):
@@ -924,6 +925,7 @@ def __init__(self, layout, keys=None, dimensions=None, **params):
**params)
if top_level:
self.comm = self.init_comm(layout)
+ self.traverse(lambda x: setattr(x, 'comm', self.comm))
self.streams = [s for streams in layout.traverse(lambda x: x.streams,
[DynamicMap])
for s in streams]