Show More
@@ -113,6 +113,7 b' class ZMQTerminalIPythonApp(TerminalIPythonApp, IPythonConsoleApp):' | |||||
113 | manager=self.kernel_manager, |
|
113 | manager=self.kernel_manager, | |
114 | client=self.kernel_client, |
|
114 | client=self.kernel_client, | |
115 | ) |
|
115 | ) | |
|
116 | self.shell.own_kernel = not self.existing | |||
116 |
|
117 | |||
117 | def init_gui_pylab(self): |
|
118 | def init_gui_pylab(self): | |
118 | # no-op, because we don't want to import matplotlib in the frontend. |
|
119 | # no-op, because we don't want to import matplotlib in the frontend. |
@@ -212,6 +212,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
212 | elif source == 'set_next_input': |
|
212 | elif source == 'set_next_input': | |
213 | self.set_next_input(item['text']) |
|
213 | self.set_next_input(item['text']) | |
214 | elif source == 'ask_exit': |
|
214 | elif source == 'ask_exit': | |
|
215 | self.keepkernel=item.get('keepkernel', False) | |||
215 | self.ask_exit() |
|
216 | self.ask_exit() | |
216 |
|
217 | |||
217 | elif status == 'error': |
|
218 | elif status == 'error': | |
@@ -233,7 +234,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
233 | Only relevant if include_other_output is True. |
|
234 | Only relevant if include_other_output is True. | |
234 | """ |
|
235 | """ | |
235 | ) |
|
236 | ) | |
236 |
|
237 | |||
237 | def from_here(self, msg): |
|
238 | def from_here(self, msg): | |
238 | """Return whether a message is from this session""" |
|
239 | """Return whether a message is from this session""" | |
239 | return msg['parent_header'].get("session", self.session_id) == self.session_id |
|
240 | return msg['parent_header'].get("session", self.session_id) == self.session_id | |
@@ -409,6 +410,7 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
409 | self.client.input(raw_data) |
|
410 | self.client.input(raw_data) | |
410 |
|
411 | |||
411 | def mainloop(self, display_banner=False): |
|
412 | def mainloop(self, display_banner=False): | |
|
413 | self.keepkernel = False | |||
412 | while True: |
|
414 | while True: | |
413 | try: |
|
415 | try: | |
414 | self.interact(display_banner=display_banner) |
|
416 | self.interact(display_banner=display_banner) | |
@@ -421,7 +423,15 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||||
421 | # handling seems rather unpredictable... |
|
423 | # handling seems rather unpredictable... | |
422 | self.write("\nKeyboardInterrupt in interact()\n") |
|
424 | self.write("\nKeyboardInterrupt in interact()\n") | |
423 |
|
425 | |||
424 | self.client.shutdown() |
|
426 | ||
|
427 | if self.keepkernel and not self.own_kernel: | |||
|
428 | print('keeping kernel alive') | |||
|
429 | elif self.keepkernel and self.own_kernel : | |||
|
430 | print("owning kernel, cannot keep it alive") | |||
|
431 | self.client.shutdown() | |||
|
432 | else : | |||
|
433 | print("Shutting down kernel") | |||
|
434 | self.client.shutdown() | |||
425 |
|
435 | |||
426 | def _banner1_default(self): |
|
436 | def _banner1_default(self): | |
427 | return "IPython Console {version}\n".format(version=release.version) |
|
437 | return "IPython Console {version}\n".format(version=release.version) |
General Comments 0
You need to be logged in to leave comments.
Login now