Show More
@@ -59,21 +59,21 b' def set_qt_api(gui):' | |||
|
59 | 59 | loaded = loaded_api() |
|
60 | 60 | |
|
61 | 61 | qt_env2gui = { |
|
62 |
QT_API_PYSIDE: |
|
|
63 |
QT_API_PYQTv1: |
|
|
64 |
QT_API_PYQT: |
|
|
65 |
QT_API_PYSIDE2: |
|
|
66 |
QT_API_PYQT5: |
|
|
67 |
QT_API_PYSIDE6: |
|
|
68 |
QT_API_PYQT6: |
|
|
62 | QT_API_PYSIDE: "qt4", | |
|
63 | QT_API_PYQTv1: "qt4", | |
|
64 | QT_API_PYQT: "qt4", | |
|
65 | QT_API_PYSIDE2: "qt5", | |
|
66 | QT_API_PYQT5: "qt5", | |
|
67 | QT_API_PYSIDE6: "qt6", | |
|
68 | QT_API_PYQT6: "qt6", | |
|
69 | 69 | } |
|
70 |
if loaded is not None and gui != |
|
|
70 | if loaded is not None and gui != "qt": | |
|
71 | 71 | if qt_env2gui[loaded] != gui: |
|
72 | 72 | raise ImportError( |
|
73 |
f |
|
|
73 | f"Cannot switch Qt versions for this session; must use {qt_env2gui[loaded]}." | |
|
74 | 74 | ) |
|
75 | 75 | |
|
76 |
if qt_api is not None and gui != |
|
|
76 | if qt_api is not None and gui != "qt": | |
|
77 | 77 | if qt_env2gui[qt_api] != gui: |
|
78 | 78 | print( |
|
79 | 79 | f'Request for "{gui}" will be ignored because `QT_API` ' |
@@ -12,14 +12,14 b' guis_avail = []' | |||
|
12 | 12 | def _get_qt_vers(): |
|
13 | 13 | """If any version of Qt is available, this will populate `guis_avail` with 'qt' and 'qtx'. Due |
|
14 | 14 | to the import mechanism, we can't import multiple versions of Qt in one session.""" |
|
15 |
for gui in [ |
|
|
16 |
print(f |
|
|
15 | for gui in ["qt", "qt6", "qt5", "qt4"]: | |
|
16 | print(f"Trying {gui}") | |
|
17 | 17 | try: |
|
18 | 18 | set_qt_api(gui) |
|
19 | 19 | importlib.import_module("IPython.terminal.pt_inputhooks.qt") |
|
20 | 20 | guis_avail.append(gui) |
|
21 |
if |
|
|
22 |
del os.environ[ |
|
|
21 | if "QT_API" in os.environ.keys(): | |
|
22 | del os.environ["QT_API"] | |
|
23 | 23 | except ImportError: |
|
24 | 24 | pass # that version of Qt isn't available. |
|
25 | 25 | except RuntimeError: |
@@ -29,7 +29,9 b' def _get_qt_vers():' | |||
|
29 | 29 | _get_qt_vers() |
|
30 | 30 | |
|
31 | 31 | |
|
32 | @pytest.mark.skipif(len(guis_avail) == 0, reason='No viable version of PyQt or PySide installed.') | |
|
32 | @pytest.mark.skipif( | |
|
33 | len(guis_avail) == 0, reason="No viable version of PyQt or PySide installed." | |
|
34 | ) | |
|
33 | 35 | def test_inputhook_qt(): |
|
34 | 36 | gui = guis_avail[0] |
|
35 | 37 | |
@@ -37,7 +39,7 b' def test_inputhook_qt():' | |||
|
37 | 39 | get_inputhook_name_and_func(gui) |
|
38 | 40 | |
|
39 | 41 | # ...and now we're stuck with this version of Qt for good; can't switch. |
|
40 |
for not_gui in [ |
|
|
42 | for not_gui in ["qt6", "qt5", "qt4"]: | |
|
41 | 43 | if not_gui not in guis_avail: |
|
42 | 44 | break |
|
43 | 45 | |
@@ -45,4 +47,4 b' def test_inputhook_qt():' | |||
|
45 | 47 | get_inputhook_name_and_func(not_gui) |
|
46 | 48 | |
|
47 | 49 | # A gui of 'qt' means "best available", or in this case, the last one that was used. |
|
48 |
get_inputhook_name_and_func( |
|
|
50 | get_inputhook_name_and_func("qt") |
General Comments 0
You need to be logged in to leave comments.
Login now