##// END OF EJS Templates
Gtk3 integration with ipython works.
Thomi Richards -
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 #-----------------------------------------------------------------------------
@@ -100,7 +101,7 b' class InputHookManager(object):'
100 101 This class installs various hooks under ``PyOSInputHook`` to handle
101 102 GUI event loop integration.
102 103 """
103
104
104 105 def __init__(self):
105 106 if ctypes is None:
106 107 warn("IPython GUI event loop requires ctypes, %gui will not be available\n")
@@ -222,7 +223,7 b' class InputHookManager(object):'
222 223
223 224 def enable_qt4(self, app=None):
224 225 """Enable event loop integration with PyQt4.
225
226
226 227 Parameters
227 228 ----------
228 229 app : Qt Application, optional.
@@ -288,7 +289,7 b' class InputHookManager(object):'
288 289
289 290 def disable_gtk(self):
290 291 """Disable event loop integration with PyGTK.
291
292
292 293 This merely sets PyOS_InputHook to NULL.
293 294 """
294 295 self.clear_inputhook()
@@ -319,7 +320,7 b' class InputHookManager(object):'
319 320
320 321 def disable_tk(self):
321 322 """Disable event loop integration with Tkinter.
322
323
323 324 This merely sets PyOS_InputHook to NULL.
324 325 """
325 326 self.clear_inputhook()
@@ -345,7 +346,7 b' class InputHookManager(object):'
345 346 without first creating a window. You should thus not create another
346 347 window but use instead the created one. See 'gui-glut.py' in the
347 348 docs/examples/lib directory.
348
349
349 350 The default screen mode is set to:
350 351 glut.GLUT_DOUBLE | glut.GLUT_RGBA | glut.GLUT_DEPTH
351 352 """
@@ -379,7 +380,7 b' class InputHookManager(object):'
379 380
380 381 def disable_glut(self):
381 382 """Disable event loop integration with glut.
382
383
383 384 This sets PyOS_InputHook to NULL and set the display function to a
384 385 dummy one and set the timer to a dummy timer that will be triggered
385 386 very far in the future.
@@ -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