##// END OF EJS Templates
Override terminal size in doctests to standardise traceback format...
Override terminal size in doctests to standardise traceback format Should fix test failures on Jenkins

File last commit:

r22118:a7117871
r22157:ca5c9233
Show More
__init__.py
38 lines | 821 B | text/x-python | PythonLexer
Thomas Kluyver
Write & borrow some inputhooks for prompt_toolkit
r21934 import importlib
import os
aliases = {
Thomas Kluyver
Add prompt_toolkit input hooks for wx
r21941 'qt4': 'qt',
Thomas Kluyver
Better error message for unknown input hook...
r22118 'gtk2': 'gtk',
Thomas Kluyver
Write & borrow some inputhooks for prompt_toolkit
r21934 }
Thomas Kluyver
Better error message for unknown input hook...
r22118 backends = [
'qt', 'qt4', 'qt5',
'gtk', 'gtk2', 'gtk3',
'tk',
'wx',
'pyglet', 'glut',
]
class UnknownBackend(KeyError):
def __init__(self, name):
self.name = name
def __str__(self):
return ("No event loop integration for {!r}. "
"Supported event loops are: {}").format(self.name,
', '.join(backends))
Thomas Kluyver
Write & borrow some inputhooks for prompt_toolkit
r21934 def get_inputhook_func(gui):
Thomas Kluyver
Better error message for unknown input hook...
r22118 if gui not in backends:
raise UnknownBackend(gui)
Thomas Kluyver
Write & borrow some inputhooks for prompt_toolkit
r21934 if gui in aliases:
return get_inputhook_func(aliases[gui])
if gui == 'qt5':
os.environ['QT_API'] = 'pyqt5'
Thomas Kluyver
Better error message for unknown input hook...
r22118 gui = 'qt'
Thomas Kluyver
Write & borrow some inputhooks for prompt_toolkit
r21934
mod = importlib.import_module('IPython.terminal.pt_inputhooks.'+gui)
return mod.inputhook