Show More
@@ -913,6 +913,10 class TerminalInteractiveShell(InteractiveShell): | |||
|
913 | 913 | |
|
914 | 914 | active_eventloop = None |
|
915 | 915 | def enable_gui(self, gui=None): |
|
916 | if self._inputhook is None and gui is None: | |
|
917 | print("No event loop hook running.") | |
|
918 | return | |
|
919 | ||
|
916 | 920 | if self._inputhook is not None and gui is not None: |
|
917 | 921 | print( |
|
918 | 922 | f"Shell is already running a gui event loop for {self.active_eventloop}. " |
@@ -920,7 +924,6 class TerminalInteractiveShell(InteractiveShell): | |||
|
920 | 924 | ) |
|
921 | 925 | return |
|
922 | 926 | if self._inputhook is not None and gui is None: |
|
923 | print('GUI event loop hook disabled.') | |
|
924 | 927 | self.active_eventloop = self._inputhook = None |
|
925 | 928 | |
|
926 | 929 | if gui and (gui not in {"inline", "webagg"}): |
@@ -940,15 +943,18 class TerminalInteractiveShell(InteractiveShell): | |||
|
940 | 943 | # same event loop as the rest of the code. don't use an actual |
|
941 | 944 | # input hook. (Asyncio is not made for nesting event loops.) |
|
942 | 945 | self.pt_loop = get_asyncio_loop() |
|
946 | print("Installed asyncio event loop hook.") | |
|
943 | 947 | |
|
944 | 948 | elif self._inputhook: |
|
945 | 949 | # If an inputhook was set, create a new asyncio event loop with |
|
946 | 950 | # this inputhook for the prompt. |
|
947 | 951 | self.pt_loop = new_eventloop_with_inputhook(self._inputhook) |
|
952 | print(f"Installed {self.active_eventloop} event loop hook.") | |
|
948 | 953 | else: |
|
949 | 954 | # When there's no inputhook, run the prompt in a separate |
|
950 | 955 | # asyncio event loop. |
|
951 | 956 | self.pt_loop = asyncio.new_event_loop() |
|
957 | print("GUI event loop hook disabled.") | |
|
952 | 958 | |
|
953 | 959 | # Run !system commands directly, not through pipes, so terminal programs |
|
954 | 960 | # work correctly. |
General Comments 0
You need to be logged in to leave comments.
Login now