Show More
@@ -21,6 +21,7 b' from IPython.lib.inputhook import (' | |||
|
21 | 21 | enable_tk, disable_tk, |
|
22 | 22 | enable_glut, disable_glut, |
|
23 | 23 | enable_pyglet, disable_pyglet, |
|
24 | enable_gtk3, disable_gtk3, | |
|
24 | 25 | set_inputhook, clear_inputhook, |
|
25 | 26 | current_gui |
|
26 | 27 | ) |
@@ -36,6 +36,7 b" GUI_TK = 'tk'" | |||
|
36 | 36 | GUI_OSX = 'osx' |
|
37 | 37 | GUI_GLUT = 'glut' |
|
38 | 38 | GUI_PYGLET = 'pyglet' |
|
39 | GUI_GTK3 = 'gtk3' | |
|
39 | 40 | GUI_NONE = 'none' # i.e. disable |
|
40 | 41 | |
|
41 | 42 | #----------------------------------------------------------------------------- |
@@ -421,6 +422,33 b' class InputHookManager(object):' | |||
|
421 | 422 | """ |
|
422 | 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 | 452 | def current_gui(self): |
|
425 | 453 | """Return a string indicating the currently active GUI or None.""" |
|
426 | 454 | return self._current_gui |
@@ -439,6 +467,8 b' enable_glut = inputhook_manager.enable_glut' | |||
|
439 | 467 | disable_glut = inputhook_manager.disable_glut |
|
440 | 468 | enable_pyglet = inputhook_manager.enable_pyglet |
|
441 | 469 | disable_pyglet = inputhook_manager.disable_pyglet |
|
470 | enable_gtk3 = inputhook_manager.enable_gtk3 | |
|
471 | disable_gtk3 = inputhook_manager.disable_gtk3 | |
|
442 | 472 | clear_inputhook = inputhook_manager.clear_inputhook |
|
443 | 473 | set_inputhook = inputhook_manager.set_inputhook |
|
444 | 474 | current_gui = inputhook_manager.current_gui |
@@ -480,6 +510,7 b' def enable_gui(gui=None, app=None):' | |||
|
480 | 510 | GUI_QT4: enable_qt4, |
|
481 | 511 | GUI_GLUT: enable_glut, |
|
482 | 512 | GUI_PYGLET: enable_pyglet, |
|
513 | GUI_GTK3: enable_gtk3, | |
|
483 | 514 | } |
|
484 | 515 | try: |
|
485 | 516 | gui_hook = guis[gui] |
General Comments 0
You need to be logged in to leave comments.
Login now