From 48266924b27bd17699be11fc9502199ecbc14acb 2011-10-11 09:52:48 From: Christian Boos Date: 2011-10-11 09:52:48 Subject: [PATCH] inputhook: use '%gui none' for disabling the input hook. --- diff --git a/IPython/lib/inputhook.py b/IPython/lib/inputhook.py index 1dc40d9..e60d238 100644 --- a/IPython/lib/inputhook.py +++ b/IPython/lib/inputhook.py @@ -32,6 +32,7 @@ GUI_TK = 'tk' GUI_OSX = 'osx' GUI_GLUT = 'glut' GUI_PYGLET = 'pyglet' +GUI_NONE = 'none' # i.e. disable #----------------------------------------------------------------------------- # Utilities @@ -417,8 +418,8 @@ def enable_gui(gui=None, app=None): Parameters ---------- gui : optional, string or None - If None, clears input hook, otherwise it must be one of the recognized - GUI names (see ``GUI_*`` constants in module). + If None (or 'none'), clears input hook, otherwise it must be one + of the recognized GUI names (see ``GUI_*`` constants in module). app : optional, existing application object. For toolkits that have the concept of a global app, you can supply an @@ -433,6 +434,7 @@ def enable_gui(gui=None, app=None): one. """ guis = {None: clear_inputhook, + GUI_NONE: clear_inputhook, GUI_OSX: lambda app=False: None, GUI_TK: enable_tk, GUI_GTK: enable_gtk, diff --git a/IPython/lib/inputhookqt4.py b/IPython/lib/inputhookqt4.py index b7c78f3..5e896a6 100644 --- a/IPython/lib/inputhookqt4.py +++ b/IPython/lib/inputhookqt4.py @@ -90,8 +90,11 @@ def create_inputhook_qt4(mgr, app=None): except KeyboardInterrupt: got_kbdint[0] = True mgr.clear_inputhook() - print("\n(event loop interrupted - " - "hit CTRL+C again to clear the prompt)") + 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") return 0 def preprompthook_qt4(ishell):