Show More
@@ -209,7 +209,8 b' loop_map = {' | |||
|
209 | 209 | def enable_gui(gui, kernel=None): |
|
210 | 210 | """Enable integration with a given GUI""" |
|
211 | 211 | if gui not in loop_map: |
|
212 | raise ValueError("GUI %r not supported" % gui) | |
|
212 | e = "Invalid GUI request %r, valid ones are:%s" % (gui, loop_map.keys()) | |
|
213 | raise ValueError(e) | |
|
213 | 214 | if kernel is None: |
|
214 | 215 | if Application.initialized(): |
|
215 | 216 | kernel = getattr(Application.instance(), 'kernel', None) |
@@ -503,8 +503,13 b' class ZMQInteractiveShell(InteractiveShell):' | |||
|
503 | 503 | |
|
504 | 504 | # Over ZeroMQ, GUI control isn't done with PyOS_InputHook as there is no |
|
505 | 505 | # interactive input being read; we provide event loop support in ipkernel |
|
506 | from .eventloops import enable_gui | |
|
507 | enable_gui = staticmethod(enable_gui) | |
|
506 | @staticmethod | |
|
507 | def enable_gui(gui): | |
|
508 | from .eventloops import enable_gui as real_enable_gui | |
|
509 | try: | |
|
510 | real_enable_gui(gui) | |
|
511 | except ValueError as e: | |
|
512 | raise UsageError("%s" % e) | |
|
508 | 513 | |
|
509 | 514 | def init_environment(self): |
|
510 | 515 | """Configure the user's environment. |
@@ -304,7 +304,10 b' class TerminalInteractiveShell(InteractiveShell):' | |||
|
304 | 304 | """ |
|
305 | 305 | # Deferred import |
|
306 | 306 | from IPython.lib.inputhook import enable_gui as real_enable_gui |
|
307 | return real_enable_gui(gui, app) | |
|
307 | try: | |
|
308 | return real_enable_gui(gui, app) | |
|
309 | except ValueError as e: | |
|
310 | raise UsageError("%s" % e) | |
|
308 | 311 | |
|
309 | 312 | def __init__(self, config=None, ipython_dir=None, profile_dir=None, |
|
310 | 313 | user_ns=None, user_module=None, custom_exceptions=((),None), |
General Comments 0
You need to be logged in to leave comments.
Login now