From 464cb8923a38e1a283b3699aeeabd9cf8d3c4440 2011-12-15 22:09:50 From: Fernando Perez Date: 2011-12-15 22:09:50 Subject: [PATCH] Merge pull request #1160 from ipython/inputhookqt4 Don't ignore ctrl-C during `%gui qt` PR #815 ignores ctrl-C during normal code execution, this restores the sigint handler outside the inputhook. Closes #1157. --- diff --git a/IPython/lib/inputhookqt4.py b/IPython/lib/inputhookqt4.py index 0c0afa8..71c6df6 100644 --- a/IPython/lib/inputhookqt4.py +++ b/IPython/lib/inputhookqt4.py @@ -91,21 +91,19 @@ def create_inputhook_qt4(mgr, app=None): timer.start(50) app.exec_() timer.stop() - ignore_CTRL_C() except KeyboardInterrupt: ignore_CTRL_C() got_kbdint[0] = True - print("\nKeyboardInterrupt - qt4 event loop interrupted!" - "\n * hit CTRL+C again to clear the prompt" - "\n * use '%gui none' to disable the event loop" - " permanently" - "\n and '%gui qt4' to re-enable it later") + print("\nKeyboardInterrupt - Ctrl-C again for new prompt") mgr.clear_inputhook() except: # NO exceptions are allowed to escape from a ctypes callback + ignore_CTRL_C() mgr.clear_inputhook() from traceback import print_exc print_exc() print("Got exception from inputhook_qt4, unregistering.") + finally: + allow_CTRL_C() return 0 def preprompthook_qt4(ishell):