MCPcopy Create free account
hub / github.com/ipython/ipython / enable_gui

Method enable_gui

IPython/terminal/interactiveshell.py:585–611  ·  view source on GitHub ↗
(self, gui=None)

Source from the content-addressed store, hash-verified

583
584 active_eventloop = None
585 def enable_gui(self, gui=None):
586 if gui and (gui != 'inline') :
587 self.active_eventloop, self._inputhook =\
588 get_inputhook_name_and_func(gui)
589 else:
590 self.active_eventloop = self._inputhook = None
591
592 # For prompt_toolkit 3.0. We have to create an asyncio event loop with
593 # this inputhook.
594 if PTK3:
595 import asyncio
596 from prompt_toolkit.eventloop import new_eventloop_with_inputhook
597
598 if gui == 'asyncio':
599 # When we integrate the asyncio event loop, run the UI in the
600 # same event loop as the rest of the code. don't use an actual
601 # input hook. (Asyncio is not made for nesting event loops.)
602 self.pt_loop = asyncio.get_event_loop()
603
604 elif self._inputhook:
605 # If an inputhook was set, create a new asyncio event loop with
606 # this inputhook for the prompt.
607 self.pt_loop = new_eventloop_with_inputhook(self._inputhook)
608 else:
609 # When there's no inputhook, run the prompt in a separate
610 # asyncio event loop.
611 self.pt_loop = asyncio.new_event_loop()
612
613 # Run !system commands directly, not through pipes, so terminal programs
614 # work correctly.

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected