##// END OF EJS Templates
Deprecation warnings for enable_* functions in inputhook...
Thomas Kluyver -
Show More
@@ -549,12 +549,21 b' register = inputhook_manager.register'
549 549 guis = inputhook_manager.guihooks
550 550
551 551 # Deprecated methods: kept for backwards compatibility, do not use in new code
552 enable_wx = lambda app=None: inputhook_manager.enable_gui('wx', app)
553 enable_qt4 = lambda app=None: inputhook_manager.enable_gui('qt4', app)
554 enable_gtk = lambda app=None: inputhook_manager.enable_gui('gtk', app)
555 enable_tk = lambda app=None: inputhook_manager.enable_gui('tk', app)
556 enable_glut = lambda app=None: inputhook_manager.enable_gui('glut', app)
557 enable_pyglet = lambda app=None: inputhook_manager.enable_gui('pyglet', app)
558 enable_gtk3 = lambda app=None: inputhook_manager.enable_gui('gtk3', app)
552 def _make_deprecated_enable(name):
553 def enable_toolkit(app=None):
554 warn("This function is deprecated - use enable_gui(%r) instead" % name)
555 inputhook_manager.enable_gui(name, app)
556
557 enable_wx = _make_deprecated_enable('wx')
558 enable_qt4 = _make_deprecated_enable('qt4')
559 enable_gtk = _make_deprecated_enable('gtk')
560 enable_tk = _make_deprecated_enable('tk')
561 enable_glut = _make_deprecated_enable('glut')
562 enable_pyglet = _make_deprecated_enable('pyglet')
563 enable_gtk3 = _make_deprecated_enable('gtk3')
564
565 def _deprecated_disable():
566 warn("This function is deprecated: use disable_gui() instead")
567 inputhook_manager.disable_gui()
559 568 disable_wx = disable_qt4 = disable_gtk = disable_gtk3 = disable_glut = \
560 disable_pyglet = inputhook_manager.disable_gui No newline at end of file
569 disable_pyglet = _deprecated_disable
@@ -33,7 +33,7 b' button.show()'
33 33 window.show()
34 34
35 35 try:
36 from IPython.lib.inputhook import enable_gtk
37 enable_gtk()
36 from IPython.lib.inputhook import enable_gui
37 enable_gui('gtk')
38 38 except ImportError:
39 39 gtk.main()
@@ -31,7 +31,7 b' button.show()'
31 31 window.show()
32 32
33 33 try:
34 from IPython.lib.inputhook import enable_gtk3
35 enable_gtk3()
34 from IPython.lib.inputhook import enable_gui
35 enable_gui('gtk3')
36 36 except ImportError:
37 37 Gtk.main()
@@ -27,7 +27,7 b' def on_draw():'
27 27 label.draw()
28 28
29 29 try:
30 from IPython.lib.inputhook import enable_pyglet
31 enable_pyglet()
30 from IPython.lib.inputhook import enable_gui
31 enable_gui('pyglet')
32 32 except ImportError:
33 33 pyglet.app.run()
@@ -30,6 +30,7 b' root = Tk()'
30 30 app = MyApp(root)
31 31
32 32 try:
33 from IPython.lib.inputhook import enable_tk; enable_tk(root)
33 from IPython.lib.inputhook import enable_gui
34 enable_gui('tk', root)
34 35 except ImportError:
35 36 root.mainloop()
@@ -100,7 +100,7 b" if __name__ == '__main__':"
100 100 frame.Show(True)
101 101
102 102 try:
103 from IPython.lib.inputhook import enable_wx
104 enable_wx(app)
103 from IPython.lib.inputhook import enable_gui
104 enable_gui('wx', app)
105 105 except ImportError:
106 106 app.MainLoop()
General Comments 0
You need to be logged in to leave comments. Login now