##// END OF EJS Templates
Added a first_reply signal to the heartbeat channel.
Brian Granger -
Show More
@@ -3,7 +3,6 b''
3 3
4 4 # System library imports.
5 5 from PyQt4 import QtCore
6 import zmq
7 6
8 7 # IPython imports.
9 8 from IPython.utils.traitlets import Type
@@ -42,11 +41,19 b' class QtXReqSocketChannel(SocketChannelQObject, XReqSocketChannel):'
42 41 # Emitted when any message is received.
43 42 message_received = QtCore.pyqtSignal(object)
44 43
45 # Emitted when a reply has been received for the corresponding request type.
44 # Emitted when a reply has been received for the corresponding request
45 # type.
46 46 execute_reply = QtCore.pyqtSignal(object)
47 47 complete_reply = QtCore.pyqtSignal(object)
48 48 object_info_reply = QtCore.pyqtSignal(object)
49 49
50 # Emitted when the first reply comes back
51 first_reply = QtCore.pyqtSignal(object)
52
53 # Used by the first_reply signal logic to determine if a reply is the
54 # first.
55 _handlers_called = False
56
50 57 #---------------------------------------------------------------------------
51 58 # 'XReqSocketChannel' interface
52 59 #---------------------------------------------------------------------------
@@ -63,6 +70,16 b' class QtXReqSocketChannel(SocketChannelQObject, XReqSocketChannel):'
63 70 if signal:
64 71 signal.emit(msg)
65 72
73 if not self._handlers_called:
74 self.first_reply.emit()
75
76 self._handlers_called = True
77
78 def reset_first_reply(self):
79 """ Reset the first_reply signal to fire again on the next reply.
80 """
81 self._handlers_called = False
82
66 83
67 84 class QtSubSocketChannel(SocketChannelQObject, SubSocketChannel):
68 85
@@ -98,7 +98,7 b' class Kernel(Configurable):'
98 98 # Build dict of handlers for message types
99 99 msg_types = [ 'execute_request', 'complete_request',
100 100 'object_info_request', 'history_request',
101 'shutdown_request']
101 'connect_request', 'shutdown_request']
102 102 self.handlers = {}
103 103 for msg_type in msg_types:
104 104 self.handlers[msg_type] = getattr(self, msg_type)
General Comments 0
You need to be logged in to leave comments. Login now