Show More
@@ -36,11 +36,14 b' from IPython.utils.path import filefind' | |||||
36 | from IPython.utils.traitlets import ( |
|
36 | from IPython.utils.traitlets import ( | |
37 | Unicode, Instance, List, Bool, CaselessStrEnum, Dict |
|
37 | Unicode, Instance, List, Bool, CaselessStrEnum, Dict | |
38 | ) |
|
38 | ) | |
|
39 | from IPython.lib.inputhook import guis | |||
39 |
|
40 | |||
40 | #----------------------------------------------------------------------------- |
|
41 | #----------------------------------------------------------------------------- | |
41 | # Aliases and Flags |
|
42 | # Aliases and Flags | |
42 | #----------------------------------------------------------------------------- |
|
43 | #----------------------------------------------------------------------------- | |
43 |
|
44 | |||
|
45 | gui_keys = tuple(sorted([ key for key in guis if key is not None ])) | |||
|
46 | ||||
44 | backend_keys = sorted(pylabtools.backends.keys()) |
|
47 | backend_keys = sorted(pylabtools.backends.keys()) | |
45 | backend_keys.insert(0, 'auto') |
|
48 | backend_keys.insert(0, 'auto') | |
46 |
|
49 | |||
@@ -175,8 +178,8 b' class InteractiveShellApp(Configurable):' | |||||
175 | module_to_run = Unicode('', config=True, |
|
178 | module_to_run = Unicode('', config=True, | |
176 | help="Run the module as a script." |
|
179 | help="Run the module as a script." | |
177 | ) |
|
180 | ) | |
178 |
gui = CaselessStrEnum( |
|
181 | gui = CaselessStrEnum(gui_keys, config=True, | |
179 |
help="Enable GUI event loop integration |
|
182 | help="Enable GUI event loop integration with any of {0}.".format(gui_keys) | |
180 | ) |
|
183 | ) | |
181 | matplotlib = CaselessStrEnum(backend_keys, |
|
184 | matplotlib = CaselessStrEnum(backend_keys, | |
182 | config=True, |
|
185 | config=True, |
@@ -481,6 +481,19 b' set_inputhook = inputhook_manager.set_inputhook' | |||||
481 | current_gui = inputhook_manager.current_gui |
|
481 | current_gui = inputhook_manager.current_gui | |
482 | clear_app_refs = inputhook_manager.clear_app_refs |
|
482 | clear_app_refs = inputhook_manager.clear_app_refs | |
483 |
|
483 | |||
|
484 | guis = {None: clear_inputhook, | |||
|
485 | GUI_NONE: clear_inputhook, | |||
|
486 | GUI_OSX: lambda app=False: None, | |||
|
487 | GUI_TK: enable_tk, | |||
|
488 | GUI_GTK: enable_gtk, | |||
|
489 | GUI_WX: enable_wx, | |||
|
490 | GUI_QT: enable_qt4, # qt3 not supported | |||
|
491 | GUI_QT4: enable_qt4, | |||
|
492 | GUI_GLUT: enable_glut, | |||
|
493 | GUI_PYGLET: enable_pyglet, | |||
|
494 | GUI_GTK3: enable_gtk3, | |||
|
495 | } | |||
|
496 | ||||
484 |
|
497 | |||
485 | # Convenience function to switch amongst them |
|
498 | # Convenience function to switch amongst them | |
486 | def enable_gui(gui=None, app=None): |
|
499 | def enable_gui(gui=None, app=None): | |
@@ -507,18 +520,6 b' def enable_gui(gui=None, app=None):' | |||||
507 | PyOS_InputHook wrapper object or the GUI toolkit app created, if there was |
|
520 | PyOS_InputHook wrapper object or the GUI toolkit app created, if there was | |
508 | one. |
|
521 | one. | |
509 | """ |
|
522 | """ | |
510 | guis = {None: clear_inputhook, |
|
|||
511 | GUI_NONE: clear_inputhook, |
|
|||
512 | GUI_OSX: lambda app=False: None, |
|
|||
513 | GUI_TK: enable_tk, |
|
|||
514 | GUI_GTK: enable_gtk, |
|
|||
515 | GUI_WX: enable_wx, |
|
|||
516 | GUI_QT: enable_qt4, # qt3 not supported |
|
|||
517 | GUI_QT4: enable_qt4, |
|
|||
518 | GUI_GLUT: enable_glut, |
|
|||
519 | GUI_PYGLET: enable_pyglet, |
|
|||
520 | GUI_GTK3: enable_gtk3, |
|
|||
521 | } |
|
|||
522 | try: |
|
523 | try: | |
523 | gui_hook = guis[gui] |
|
524 | gui_hook = guis[gui] | |
524 | except KeyError: |
|
525 | except KeyError: |
General Comments 0
You need to be logged in to leave comments.
Login now