Show More
@@ -426,18 +426,16 b' class Widget(LoggingConfigurable):' | |||||
426 | if not hasattr(self, '_comm') or self._comm is None: |
|
426 | if not hasattr(self, '_comm') or self._comm is None: | |
427 | self._comm = Comm(target_name=self.target_name) |
|
427 | self._comm = Comm(target_name=self.target_name) | |
428 | self._comm.on_msg(self._handle_msg) |
|
428 | self._comm.on_msg(self._handle_msg) | |
429 |
self._comm.on_close(self._ |
|
429 | self._comm.on_close(self._close_communication) | |
430 |
|
||||
431 |
|
||||
432 | def _handle_close(self): |
|
|||
433 | """Called when the comm is closed by the front-end.""" |
|
|||
434 | self._close_communication() |
|
|||
435 |
|
430 | |||
436 |
|
431 | |||
437 | def _close_communication(self): |
|
432 | def _close_communication(self): | |
438 | """Closes a communication with the front-end.""" |
|
433 | """Closes a communication with the front-end.""" | |
439 | if hasattr(self, '_comm') and self._comm is not None: |
|
434 | if hasattr(self, '_comm') and self._comm is not None: | |
|
435 | try: | |||
440 | self._comm.close() |
|
436 | self._comm.close() | |
|
437 | finally: | |||
|
438 | self._comm = None | |||
441 |
|
439 | |||
442 |
|
440 | |||
443 | def _send(self, msg): |
|
441 | def _send(self, msg): |
General Comments 0
You need to be logged in to leave comments.
Login now