##// END OF EJS Templates
update kernelspec model tests
update kernelspec model tests

File last commit:

r19231:cc0350f4
r19682:35413073
Show More
inprocess.py
75 lines | 2.3 KiB | text/x-python | PythonLexer
epatters
REFACTOR: Terminology change: 'embedded' -> 'in-process'.
r8471 """ Defines an in-process KernelManager with signals and slots.
"""
# Local imports.
Thomas Kluyver
Merge Qt*ChannelMixin up into QtInProcess*Channel classes
r19210 from IPython.external.qt import QtCore
MinRK
update inprocess kernel to new layout...
r10298 from IPython.kernel.inprocess import (
MinRK
fix in process qt and in process examples
r10333 InProcessHBChannel, InProcessKernelClient, InProcessKernelManager,
MinRK
update inprocess kernel to new layout...
r10298 )
Thomas Kluyver
Collapse Qt in-process channel classes together
r19222 from IPython.kernel.inprocess.channels import InProcessChannel
MinRK
update inprocess kernel to new layout...
r10298
epatters
REFACTOR: Terminology change: 'embedded' -> 'in-process'.
r8471 from IPython.utils.traitlets import Type
Thomas Kluyver
Collapse ChannelQObject class into QtInProcessChannel
r19230 from .util import SuperQObject
from .kernel_mixins import (
QtKernelClientMixin, QtKernelManagerMixin,
MinRK
fix in process qt and in process examples
r10333 )
epatters
REFACTOR: Terminology change: 'embedded' -> 'in-process'.
r8471
Thomas Kluyver
Collapse ChannelQObject class into QtInProcessChannel
r19230 class QtInProcessChannel(SuperQObject, InProcessChannel):
# Emitted when the channel is started.
started = QtCore.Signal()
# Emitted when the channel is stopped.
stopped = QtCore.Signal()
# Emitted when any message is received.
message_received = QtCore.Signal(object)
def start(self):
""" Reimplemented to emit signal.
"""
super(QtInProcessChannel, self).start()
self.started.emit()
def stop(self):
""" Reimplemented to emit signal.
"""
super(QtInProcessChannel, self).stop()
self.stopped.emit()
def call_handlers_later(self, *args, **kwds):
""" Call the message handlers later.
"""
do_later = lambda: self.call_handlers(*args, **kwds)
QtCore.QTimer.singleShot(0, do_later)
def call_handlers(self, msg):
self.message_received.emit(msg)
def process_events(self):
""" Process any pending GUI events.
"""
QtCore.QCoreApplication.instance().processEvents()
def flush(self, timeout=1.0):
""" Reimplemented to ensure that signals are dispatched immediately.
"""
super(QtInProcessChannel, self).flush()
self.process_events()
Thomas Kluyver
Restore QtInProcessHBChannel class
r19231
class QtInProcessHBChannel(SuperQObject, InProcessHBChannel):
# This signal will never be fired, but it needs to exist
kernel_died = QtCore.Signal()
epatters
REFACTOR: Terminology change: 'embedded' -> 'in-process'.
r8471
MinRK
update inprocess kernel to new layout...
r10298 class QtInProcessKernelClient(QtKernelClientMixin, InProcessKernelClient):
epatters
REFACTOR: Terminology change: 'embedded' -> 'in-process'.
r8471 """ An in-process KernelManager with signals and slots.
"""
Thomas Kluyver
Collapse Qt in-process channel classes together
r19222 iopub_channel_class = Type(QtInProcessChannel)
shell_channel_class = Type(QtInProcessChannel)
stdin_channel_class = Type(QtInProcessChannel)
Thomas Kluyver
Restore QtInProcessHBChannel class
r19231 hb_channel_class = Type(QtInProcessHBChannel)
MinRK
fix in process qt and in process examples
r10333
class QtInProcessKernelManager(QtKernelManagerMixin, InProcessKernelManager):
client_class = __module__ + '.QtInProcessKernelClient'