Show More
@@ -21,6 +21,7 b' from IPython.lib.inputhook import (' | |||||
21 | enable_tk, disable_tk, |
|
21 | enable_tk, disable_tk, | |
22 | enable_glut, disable_glut, |
|
22 | enable_glut, disable_glut, | |
23 | enable_pyglet, disable_pyglet, |
|
23 | enable_pyglet, disable_pyglet, | |
|
24 | enable_gtk3, disable_gtk3, | |||
24 | set_inputhook, clear_inputhook, |
|
25 | set_inputhook, clear_inputhook, | |
25 | current_gui |
|
26 | current_gui | |
26 | ) |
|
27 | ) |
@@ -36,6 +36,7 b" GUI_TK = 'tk'" | |||||
36 | GUI_OSX = 'osx' |
|
36 | GUI_OSX = 'osx' | |
37 | GUI_GLUT = 'glut' |
|
37 | GUI_GLUT = 'glut' | |
38 | GUI_PYGLET = 'pyglet' |
|
38 | GUI_PYGLET = 'pyglet' | |
|
39 | GUI_GTK3 = 'gtk3' | |||
39 | GUI_NONE = 'none' # i.e. disable |
|
40 | GUI_NONE = 'none' # i.e. disable | |
40 |
|
41 | |||
41 | #----------------------------------------------------------------------------- |
|
42 | #----------------------------------------------------------------------------- | |
@@ -421,6 +422,33 b' class InputHookManager(object):' | |||||
421 | """ |
|
422 | """ | |
422 | self.clear_inputhook() |
|
423 | self.clear_inputhook() | |
423 |
|
424 | |||
|
425 | def enable_gtk3(self, app=None): | |||
|
426 | """Enable event loop integration with Gtk3 (gir bindings). | |||
|
427 | ||||
|
428 | Parameters | |||
|
429 | ---------- | |||
|
430 | app : ignored | |||
|
431 | Ignored, it's only a placeholder to keep the call signature of all | |||
|
432 | gui activation methods consistent, which simplifies the logic of | |||
|
433 | supporting magics. | |||
|
434 | ||||
|
435 | Notes | |||
|
436 | ----- | |||
|
437 | This methods sets the PyOS_InputHook for Gtk3, which allows | |||
|
438 | the Gtk3 to integrate with terminal based applications like | |||
|
439 | IPython. | |||
|
440 | """ | |||
|
441 | from IPython.lib.inputhookgtk3 import inputhook_gtk3 | |||
|
442 | self.set_inputhook(inputhook_gtk3) | |||
|
443 | self._current_gui = GUI_GTK | |||
|
444 | ||||
|
445 | def disable_gtk3(self): | |||
|
446 | """Disable event loop integration with PyGTK. | |||
|
447 | ||||
|
448 | This merely sets PyOS_InputHook to NULL. | |||
|
449 | """ | |||
|
450 | self.clear_inputhook() | |||
|
451 | ||||
424 | def current_gui(self): |
|
452 | def current_gui(self): | |
425 | """Return a string indicating the currently active GUI or None.""" |
|
453 | """Return a string indicating the currently active GUI or None.""" | |
426 | return self._current_gui |
|
454 | return self._current_gui | |
@@ -439,6 +467,8 b' enable_glut = inputhook_manager.enable_glut' | |||||
439 | disable_glut = inputhook_manager.disable_glut |
|
467 | disable_glut = inputhook_manager.disable_glut | |
440 | enable_pyglet = inputhook_manager.enable_pyglet |
|
468 | enable_pyglet = inputhook_manager.enable_pyglet | |
441 | disable_pyglet = inputhook_manager.disable_pyglet |
|
469 | disable_pyglet = inputhook_manager.disable_pyglet | |
|
470 | enable_gtk3 = inputhook_manager.enable_gtk3 | |||
|
471 | disable_gtk3 = inputhook_manager.disable_gtk3 | |||
442 | clear_inputhook = inputhook_manager.clear_inputhook |
|
472 | clear_inputhook = inputhook_manager.clear_inputhook | |
443 | set_inputhook = inputhook_manager.set_inputhook |
|
473 | set_inputhook = inputhook_manager.set_inputhook | |
444 | current_gui = inputhook_manager.current_gui |
|
474 | current_gui = inputhook_manager.current_gui | |
@@ -480,6 +510,7 b' def enable_gui(gui=None, app=None):' | |||||
480 | GUI_QT4: enable_qt4, |
|
510 | GUI_QT4: enable_qt4, | |
481 | GUI_GLUT: enable_glut, |
|
511 | GUI_GLUT: enable_glut, | |
482 | GUI_PYGLET: enable_pyglet, |
|
512 | GUI_PYGLET: enable_pyglet, | |
|
513 | GUI_GTK3: enable_gtk3, | |||
483 | } |
|
514 | } | |
484 | try: |
|
515 | try: | |
485 | gui_hook = guis[gui] |
|
516 | gui_hook = guis[gui] |
General Comments 0
You need to be logged in to leave comments.
Login now