From a8b9bab9e7724c07aa8366e1a962b74963aa262d 2013-01-31 13:29:57 From: Thomas Kluyver Date: 2013-01-31 13:29:57 Subject: [PATCH] Defer import of IPython.lib.inputhook --- diff --git a/IPython/frontend/terminal/interactiveshell.py b/IPython/frontend/terminal/interactiveshell.py index 252d4ec..0787e5c 100644 --- a/IPython/frontend/terminal/interactiveshell.py +++ b/IPython/frontend/terminal/interactiveshell.py @@ -358,8 +358,12 @@ class TerminalInteractiveShell(InteractiveShell): using_paste_magics = CBool(False) # In the terminal, GUI control is done via PyOS_InputHook - from IPython.lib.inputhook import enable_gui - enable_gui = staticmethod(enable_gui) + def enable_gui(gui=None, app=None): + """Switch amongst GUI input hooks by name. + """ + # Deferred import + from IPython.lib.inputhook import enable_gui as real_enable_gui + return real_enable_gui(gui, app) def __init__(self, config=None, ipython_dir=None, profile_dir=None, user_ns=None, user_module=None, custom_exceptions=((),None), diff --git a/IPython/lib/__init__.py b/IPython/lib/__init__.py index 482dcea..8eb8901 100644 --- a/IPython/lib/__init__.py +++ b/IPython/lib/__init__.py @@ -14,18 +14,6 @@ Extra capabilities for IPython # Imports #----------------------------------------------------------------------------- -from IPython.lib.inputhook import ( - enable_wx, disable_wx, - enable_gtk, disable_gtk, - enable_qt4, disable_qt4, - enable_tk, disable_tk, - enable_glut, disable_glut, - enable_pyglet, disable_pyglet, - enable_gtk3, disable_gtk3, - set_inputhook, clear_inputhook, - current_gui -) - from IPython.lib.security import passwd #-----------------------------------------------------------------------------