##// END OF EJS Templates
Missing files added
Nicolas Rougier -
Show More
@@ -29,6 +29,7 b" GUI_QT4 = 'qt4'"
29 GUI_GTK = 'gtk'
29 GUI_GTK = 'gtk'
30 GUI_TK = 'tk'
30 GUI_TK = 'tk'
31 GUI_OSX = 'osx'
31 GUI_OSX = 'osx'
32 GUI_PYGLET = 'pyglet'
32
33
33 #-----------------------------------------------------------------------------
34 #-----------------------------------------------------------------------------
34 # Utility classes
35 # Utility classes
@@ -283,6 +284,39 b' class InputHookManager(object):'
283 """
284 """
284 self.clear_inputhook()
285 self.clear_inputhook()
285
286
287
288
289 def enable_pyglet(self, app=None):
290 """Enable event loop integration with pyglet.
291
292 Parameters
293 ----------
294 app : ignored
295 Ignored, it's only a placeholder to keep the call signature of all
296 gui activation methods consistent, which simplifies the logic of
297 supporting magics.
298
299 Notes
300 -----
301 This methods sets the ``PyOS_InputHook`` for wxPython, which allows
302 pyglet to integrate with terminal based applications like
303 IPython.
304
305 """
306 import pyglet
307 from IPython.lib.inputhookpyglet import inputhook_pyglet
308 self.set_inputhook(inputhook_pyglet)
309 self._current_gui = GUI_PYGLET
310 return app
311
312 def disable_pyglet(self):
313 """Disable event loop integration with pyglet.
314
315 This merely sets PyOS_InputHook to NULL.
316 """
317 self.clear_inputhook()
318
319
286 def current_gui(self):
320 def current_gui(self):
287 """Return a string indicating the currently active GUI or None."""
321 """Return a string indicating the currently active GUI or None."""
288 return self._current_gui
322 return self._current_gui
@@ -297,6 +331,8 b' enable_gtk = inputhook_manager.enable_gtk'
297 disable_gtk = inputhook_manager.disable_gtk
331 disable_gtk = inputhook_manager.disable_gtk
298 enable_tk = inputhook_manager.enable_tk
332 enable_tk = inputhook_manager.enable_tk
299 disable_tk = inputhook_manager.disable_tk
333 disable_tk = inputhook_manager.disable_tk
334 enable_pyglet = inputhook_manager.enable_pyglet
335 disable_pyglet = inputhook_manager.disable_pyglet
300 clear_inputhook = inputhook_manager.clear_inputhook
336 clear_inputhook = inputhook_manager.clear_inputhook
301 set_inputhook = inputhook_manager.set_inputhook
337 set_inputhook = inputhook_manager.set_inputhook
302 current_gui = inputhook_manager.current_gui
338 current_gui = inputhook_manager.current_gui
@@ -334,7 +370,9 b' def enable_gui(gui=None, app=None):'
334 GUI_GTK: enable_gtk,
370 GUI_GTK: enable_gtk,
335 GUI_WX: enable_wx,
371 GUI_WX: enable_wx,
336 GUI_QT: enable_qt4, # qt3 not supported
372 GUI_QT: enable_qt4, # qt3 not supported
337 GUI_QT4: enable_qt4 }
373 GUI_QT4: enable_qt4,
374 GUI_PYGLET: enable_pyglet,
375 }
338 try:
376 try:
339 gui_hook = guis[gui]
377 gui_hook = guis[gui]
340 except KeyError:
378 except KeyError:
General Comments 0
You need to be logged in to leave comments. Login now