Show More
@@ -127,6 +127,8 b' class Widget(LoggingConfigurable):' | |||||
127 | def __del__(self): |
|
127 | def __del__(self): | |
128 | """Object disposal""" |
|
128 | """Object disposal""" | |
129 | self.close() |
|
129 | self.close() | |
|
130 | del Widget.widgets[self.model_id] | |||
|
131 | self._comm = None | |||
130 |
|
132 | |||
131 | #------------------------------------------------------------------------- |
|
133 | #------------------------------------------------------------------------- | |
132 | # Properties |
|
134 | # Properties | |
@@ -141,7 +143,6 b' class Widget(LoggingConfigurable):' | |||||
141 | # Create a comm. |
|
143 | # Create a comm. | |
142 | self._comm = Comm(target_name=self._model_name) |
|
144 | self._comm = Comm(target_name=self._model_name) | |
143 | self._comm.on_msg(self._handle_msg) |
|
145 | self._comm.on_msg(self._handle_msg) | |
144 | self._comm.on_close(self._close) |
|
|||
145 | Widget.widgets[self.model_id] = self |
|
146 | Widget.widgets[self.model_id] = self | |
146 |
|
147 | |||
147 | # first update |
|
148 | # first update | |
@@ -158,20 +159,15 b' class Widget(LoggingConfigurable):' | |||||
158 | #------------------------------------------------------------------------- |
|
159 | #------------------------------------------------------------------------- | |
159 | # Methods |
|
160 | # Methods | |
160 | #------------------------------------------------------------------------- |
|
161 | #------------------------------------------------------------------------- | |
161 | def _close(self): |
|
|||
162 | """Private close - cleanup objects, registry entries""" |
|
|||
163 | del Widget.widgets[self.model_id] |
|
|||
164 | self._comm = None |
|
|||
165 |
|
162 | |||
166 | def close(self): |
|
163 | def close(self): | |
167 | """Close method. |
|
164 | """Close method. | |
168 |
|
165 | |||
169 |
Closes the |
|
166 | Closes the underlying comm. | |
170 | When the comm is closed, all of the widget views are automatically |
|
167 | When the comm is closed, all of the widget views are automatically | |
171 | removed from the front-end.""" |
|
168 | removed from the front-end.""" | |
172 | if self._comm is not None: |
|
169 | if self._comm is not None: | |
173 | self._comm.close() |
|
170 | self._comm.close() | |
174 | self._close() |
|
|||
175 |
|
171 | |||
176 | def send_state(self, key=None): |
|
172 | def send_state(self, key=None): | |
177 | """Sends the widget state, or a piece of it, to the front-end. |
|
173 | """Sends the widget state, or a piece of it, to the front-end. |
General Comments 0
You need to be logged in to leave comments.
Login now