|
|
|
|
@ -141,7 +141,6 @@ class Widget(LoggingConfigurable):
|
|
|
|
|
# Create a comm.
|
|
|
|
|
self._comm = Comm(target_name=self._model_name)
|
|
|
|
|
self._comm.on_msg(self._handle_msg)
|
|
|
|
|
self._comm.on_close(self._close)
|
|
|
|
|
Widget.widgets[self.model_id] = self
|
|
|
|
|
|
|
|
|
|
# first update
|
|
|
|
|
@ -158,21 +157,18 @@ class Widget(LoggingConfigurable):
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
# Methods
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
|
def _close(self):
|
|
|
|
|
"""Private close - cleanup objects, registry entries"""
|
|
|
|
|
del Widget.widgets[self.model_id]
|
|
|
|
|
self._comm = None
|
|
|
|
|
|
|
|
|
|
def close(self):
|
|
|
|
|
"""Close method.
|
|
|
|
|
|
|
|
|
|
Closes the widget which closes the underlying comm.
|
|
|
|
|
Closes the underlying comm.
|
|
|
|
|
When the comm is closed, all of the widget views are automatically
|
|
|
|
|
removed from the front-end."""
|
|
|
|
|
del Widget.widgets[self.model_id]
|
|
|
|
|
if self._comm is not None:
|
|
|
|
|
self._comm.close()
|
|
|
|
|
self._close()
|
|
|
|
|
|
|
|
|
|
self._comm = None
|
|
|
|
|
|
|
|
|
|
def send_state(self, key=None):
|
|
|
|
|
"""Sends the widget state, or a piece of it, to the front-end.
|
|
|
|
|
|
|
|
|
|
|