##// END OF EJS Templates
Get rid of unused Qt signals for specific message types
Thomas Kluyver -
Show More
@@ -203,13 +203,6 b' class QtZMQSocketChannel(SuperQObject, Thread):'
203 class QtShellChannel(QtZMQSocketChannel):
203 class QtShellChannel(QtZMQSocketChannel):
204 """The shell channel for issuing request/replies to the kernel."""
204 """The shell channel for issuing request/replies to the kernel."""
205
205
206 # Emitted when a reply has been received for the corresponding request type.
207 execute_reply = QtCore.Signal(object)
208 complete_reply = QtCore.Signal(object)
209 inspect_reply = QtCore.Signal(object)
210 history_reply = QtCore.Signal(object)
211 kernel_info_reply = QtCore.Signal(object)
212
213 def __init__(self, socket, session):
206 def __init__(self, socket, session):
214 super(QtShellChannel, self).__init__(socket, session)
207 super(QtShellChannel, self).__init__(socket, session)
215 self.ioloop = ioloop.IOLoop()
208 self.ioloop = ioloop.IOLoop()
@@ -228,11 +221,6 b' class QtShellChannel(QtZMQSocketChannel):'
228 if msg_type == 'kernel_info_reply':
221 if msg_type == 'kernel_info_reply':
229 self._handle_kernel_info_reply(msg)
222 self._handle_kernel_info_reply(msg)
230
223
231 # Emit specific signals
232 signal = getattr(self, msg_type, None)
233 if signal:
234 signal.emit(msg)
235
236 def _handle_kernel_info_reply(self, msg):
224 def _handle_kernel_info_reply(self, msg):
237 """handle kernel info reply
225 """handle kernel info reply
238
226
@@ -248,27 +236,6 b' class QtIOPubChannel(QtZMQSocketChannel):'
248
236
249 This channel is where all output is published to frontends.
237 This channel is where all output is published to frontends.
250 """
238 """
251 # Emitted when a message of type 'stream' is received.
252 stream_received = QtCore.Signal(object)
253
254 # Emitted when a message of type 'execute_input' is received.
255 execute_input_received = QtCore.Signal(object)
256
257 # Emitted when a message of type 'execute_result' is received.
258 execute_result_received = QtCore.Signal(object)
259
260 # Emitted when a message of type 'error' is received.
261 error_received = QtCore.Signal(object)
262
263 # Emitted when a message of type 'display_data' is received
264 display_data_received = QtCore.Signal(object)
265
266 # Emitted when a crash report message is received from the kernel's
267 # last-resort sys.excepthook.
268 crash_received = QtCore.Signal(object)
269
270 # Emitted when a shutdown is noticed.
271 shutdown_reply_received = QtCore.Signal(object)
272
239
273 def __init__(self, socket, session):
240 def __init__(self, socket, session):
274 super(QtIOPubChannel, self).__init__(socket, session)
241 super(QtIOPubChannel, self).__init__(socket, session)
@@ -280,15 +247,6 b' class QtIOPubChannel(QtZMQSocketChannel):'
280 self.stream.on_recv(self._handle_recv)
247 self.stream.on_recv(self._handle_recv)
281 self._run_loop()
248 self._run_loop()
282
249
283 def call_handlers(self, msg):
284 super(QtIOPubChannel, self).call_handlers(msg)
285
286 # Emit signals for specialized message types.
287 msg_type = msg['header']['msg_type']
288 signal = getattr(self, msg_type + '_received', None)
289 if signal:
290 signal.emit(msg)
291
292 def flush(self, timeout=1.0):
250 def flush(self, timeout=1.0):
293 """Immediately processes all pending messages on the iopub channel.
251 """Immediately processes all pending messages on the iopub channel.
294
252
@@ -325,9 +283,6 b' class QtStdInChannel(QtZMQSocketChannel):'
325 msg_queue = None
283 msg_queue = None
326 proxy_methods = ['input']
284 proxy_methods = ['input']
327
285
328 # Emitted when an input request is received.
329 input_requested = QtCore.Signal(object)
330
331 def __init__(self, socket, session):
286 def __init__(self, socket, session):
332 super(QtStdInChannel, self).__init__(socket, session)
287 super(QtStdInChannel, self).__init__(socket, session)
333 self.ioloop = ioloop.IOLoop()
288 self.ioloop = ioloop.IOLoop()
@@ -338,14 +293,6 b' class QtStdInChannel(QtZMQSocketChannel):'
338 self.stream.on_recv(self._handle_recv)
293 self.stream.on_recv(self._handle_recv)
339 self._run_loop()
294 self._run_loop()
340
295
341 def call_handlers(self, msg):
342 super(QtStdInChannel, self).call_handlers(msg)
343
344 # Emit signals for specialized message types.
345 msg_type = msg['header']['msg_type']
346 if msg_type == 'input_request':
347 self.input_requested.emit(msg)
348
349
296
350 ShellChannelABC.register(QtShellChannel)
297 ShellChannelABC.register(QtShellChannel)
351 IOPubChannelABC.register(QtIOPubChannel)
298 IOPubChannelABC.register(QtIOPubChannel)
@@ -357,12 +304,13 b' class QtKernelClient(QtKernelClientMixin, KernelClient):'
357 """
304 """
358 def start_channels(self, shell=True, iopub=True, stdin=True, hb=True):
305 def start_channels(self, shell=True, iopub=True, stdin=True, hb=True):
359 if shell:
306 if shell:
360 self.shell_channel.kernel_info_reply.connect(self._handle_kernel_info_reply)
307 self.shell_channel.message_received.connect(self._check_kernel_info_reply)
361 super(QtKernelClient, self).start_channels(shell, iopub, stdin, hb)
308 super(QtKernelClient, self).start_channels(shell, iopub, stdin, hb)
362
309
363 def _handle_kernel_info_reply(self, msg):
310 def _check_kernel_info_reply(self, msg):
364 super(QtKernelClient, self)._handle_kernel_info_reply(msg)
311 if msg['msg_type'] == 'kernel_info_reply':
365 self.shell_channel.kernel_info_reply.disconnect(self._handle_kernel_info_reply)
312 self._handle_kernel_info_reply(msg)
313 self.shell_channel.message_received.disconnect(self._check_kernel_info_reply)
366
314
367 iopub_channel_class = Type(QtIOPubChannel)
315 iopub_channel_class = Type(QtIOPubChannel)
368 shell_channel_class = Type(QtShellChannel)
316 shell_channel_class = Type(QtShellChannel)
General Comments 0
You need to be logged in to leave comments. Login now