##// END OF EJS Templates
Explictly return which Qt gui has been enabled.
Emilio Graff -
Show More
@@ -71,7 +71,7 b' def set_qt_api(gui):'
71 print(
71 print(
72 f"Cannot switch Qt versions for this session; will use {qt_env2gui[loaded]}."
72 f"Cannot switch Qt versions for this session; will use {qt_env2gui[loaded]}."
73 )
73 )
74 return
74 return qt_env2gui[loaded]
75
75
76 if qt_api is not None and gui != "qt":
76 if qt_api is not None and gui != "qt":
77 if qt_env2gui[qt_api] != gui:
77 if qt_env2gui[qt_api] != gui:
@@ -79,6 +79,7 b' def set_qt_api(gui):'
79 f'Request for "{gui}" will be ignored because `QT_API` '
79 f'Request for "{gui}" will be ignored because `QT_API` '
80 f'environment variable is set to "{qt_api}"'
80 f'environment variable is set to "{qt_api}"'
81 )
81 )
82 return qt_env2gui[qt_api]
82 else:
83 else:
83 if gui == "qt5":
84 if gui == "qt5":
84 try:
85 try:
@@ -110,7 +111,10 b' def set_qt_api(gui):'
110 del os.environ["QT_API"]
111 del os.environ["QT_API"]
111 else:
112 else:
112 print(f'Unrecognized Qt version: {gui}. Should be "qt5", "qt6", or "qt".')
113 print(f'Unrecognized Qt version: {gui}. Should be "qt5", "qt6", or "qt".')
113 return
114 return None
115 # Import it now so we can figure out which version it is.
116 from IPython.external.qt_for_kernel import QT_API
117 return qt_env2gui[QT_API]
114
118
115
119
116 def get_inputhook_name_and_func(gui):
120 def get_inputhook_name_and_func(gui):
@@ -125,7 +129,7 b' def get_inputhook_name_and_func(gui):'
125
129
126 gui_mod = gui
130 gui_mod = gui
127 if gui.startswith("qt"):
131 if gui.startswith("qt"):
128 set_qt_api(gui)
132 gui = set_qt_api(gui)
129 gui_mod = "qt"
133 gui_mod = "qt"
130
134
131 mod = importlib.import_module("IPython.terminal.pt_inputhooks." + gui_mod)
135 mod = importlib.import_module("IPython.terminal.pt_inputhooks." + gui_mod)
General Comments 0
You need to be logged in to leave comments. Login now