diff --git a/IPython/frontend/qt/base_kernelmanager.py b/IPython/frontend/qt/base_kernelmanager.py index 8038c61..57035f3 100644 --- a/IPython/frontend/qt/base_kernelmanager.py +++ b/IPython/frontend/qt/base_kernelmanager.py @@ -5,8 +5,8 @@ from IPython.external.qt import QtCore # IPython imports. -from IPython.utils.traitlets import Type -from util import SuperQObject +from IPython.utils.traitlets import HasTraits, Type +from util import MetaQObjectHasTraits, SuperQObject class ChannelQObject(SuperQObject): @@ -189,10 +189,12 @@ class QtHBChannelMixin(ChannelQObject): self.kernel_died.emit(since_last_heartbeat) -class QtKernelManagerMixin(object): +class QtKernelManagerMixin(HasTraits, SuperQObject): """ A KernelManager that provides signals and slots. """ + __metaclass__ = MetaQObjectHasTraits + # Emitted when the kernel manager has started listening. started_kernel = QtCore.Signal() diff --git a/IPython/frontend/qt/embedded_kernelmanager.py b/IPython/frontend/qt/embedded_kernelmanager.py index e78ccad..904fdac 100644 --- a/IPython/frontend/qt/embedded_kernelmanager.py +++ b/IPython/frontend/qt/embedded_kernelmanager.py @@ -8,7 +8,6 @@ from IPython.embedded.kernelmanager import \ from IPython.utils.traitlets import Type from base_kernelmanager import QtShellChannelMixin, QtSubChannelMixin, \ QtStdInChannelMixin, QtHBChannelMixin, QtKernelManagerMixin -from util import MetaQObjectHasTraits, SuperQObject class QtShellEmbeddedChannel(QtShellChannelMixin, ShellEmbeddedChannel): @@ -24,13 +23,10 @@ class QtHBEmbeddedChannel(QtHBChannelMixin, HBEmbeddedChannel): pass -class QtEmbeddedKernelManager(QtKernelManagerMixin, - EmbeddedKernelManager, SuperQObject): +class QtEmbeddedKernelManager(QtKernelManagerMixin, EmbeddedKernelManager): """ An embedded KernelManager that provides signals and slots. """ - __metaclass__ = MetaQObjectHasTraits - sub_channel_class = Type(QtSubEmbeddedChannel) shell_channel_class = Type(QtShellEmbeddedChannel) stdin_channel_class = Type(QtStdInEmbeddedChannel) diff --git a/IPython/frontend/qt/kernelmanager.py b/IPython/frontend/qt/kernelmanager.py index cb815cb..bca2575 100644 --- a/IPython/frontend/qt/kernelmanager.py +++ b/IPython/frontend/qt/kernelmanager.py @@ -7,7 +7,6 @@ from IPython.zmq.kernelmanager import ShellSocketChannel, SubSocketChannel, \ StdInSocketChannel, HBSocketChannel, KernelManager from base_kernelmanager import QtShellChannelMixin, QtSubChannelMixin, \ QtStdInChannelMixin, QtHBChannelMixin, QtKernelManagerMixin -from util import MetaQObjectHasTraits, SuperQObject class QtShellSocketChannel(QtShellChannelMixin, ShellSocketChannel): @@ -23,12 +22,10 @@ class QtHBSocketChannel(QtHBChannelMixin, HBSocketChannel): pass -class QtKernelManager(QtKernelManagerMixin, KernelManager, SuperQObject): +class QtKernelManager(QtKernelManagerMixin, KernelManager): """ A KernelManager that provides signals and slots. """ - __metaclass__ = MetaQObjectHasTraits - sub_channel_class = Type(QtSubSocketChannel) shell_channel_class = Type(QtShellSocketChannel) stdin_channel_class = Type(QtStdInSocketChannel) diff --git a/IPython/frontend/qt/util.py b/IPython/frontend/qt/util.py index 096c27e..38528d7 100644 --- a/IPython/frontend/qt/util.py +++ b/IPython/frontend/qt/util.py @@ -56,7 +56,7 @@ class SuperQObject(QtCore.QObject): they don't inherit QObject.) This class is primarily useful for attaching signals to existing non-Qt - classes. See QtKernelManager for an example. + classes. See QtKernelManagerMixin for an example. """ def __new__(cls, *args, **kw):