1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- """Defines a KernelManager that provides signals and slots."""
- # Copyright (c) Jupyter Development Team.
- # Distributed under the terms of the Modified BSD License.
- from qtpy import QtCore
- from traitlets import HasTraits, Type
- from .util import MetaQObjectHasTraits, SuperQObject
- from .comms import CommManager
- class QtKernelRestarterMixin(MetaQObjectHasTraits('NewBase', (HasTraits, SuperQObject), {})):
- _timer = None
- class QtKernelManagerMixin(MetaQObjectHasTraits('NewBase', (HasTraits, SuperQObject), {})):
- """ A KernelClient that provides signals and slots.
- """
- kernel_restarted = QtCore.Signal()
- class QtKernelClientMixin(MetaQObjectHasTraits('NewBase', (HasTraits, SuperQObject), {})):
- """ A KernelClient that provides signals and slots.
- """
- # Emitted when the kernel client has started listening.
- started_channels = QtCore.Signal()
- # Emitted when the kernel client has stopped listening.
- stopped_channels = QtCore.Signal()
- #---------------------------------------------------------------------------
- # 'KernelClient' interface
- #---------------------------------------------------------------------------
- def __init__(self, *args, **kwargs):
- super(QtKernelClientMixin, self).__init__(*args, **kwargs)
- self.comm_manager = None
- #------ Channel management -------------------------------------------------
- def start_channels(self, *args, **kw):
- """ Reimplemented to emit signal.
- """
- super(QtKernelClientMixin, self).start_channels(*args, **kw)
- self.started_channels.emit()
- self.comm_manager = CommManager(parent=self, kernel_client=self)
- def stop_channels(self):
- """ Reimplemented to emit signal.
- """
- super(QtKernelClientMixin, self).stop_channels()
- self.stopped_channels.emit()
- self.comm_manager = None
|