Fixed _send so it can open a comm if needed.

It no longer returns anything.
This commit is contained in:
Jonathan Frederic 2014-01-07 15:13:07 -08:00 committed by Jonathan Frederic
parent 85b5adff58
commit 463bcf85ee

View File

@ -278,7 +278,8 @@ class Widget(LoggingConfigurable):
view_name: unicode (optional)
View to display in the frontend. Overrides view_name."""
# Show view.
# Show view. By sending a display message, the comm is opened and the
# initial state is sent.
self._send({"method": "display", "view_name": view_name})
self._displayed = True
self._handle_displayed(**kwargs)
@ -307,11 +308,7 @@ class Widget(LoggingConfigurable):
def _send(self, msg):
"""Sends a message to the model in the front-end"""
if self._comm is not None:
self._comm.send(msg)
return True
else:
return False
self.comm.send(msg)
class DOMWidget(Widget):