summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoofar <toofar@spalge.com>2022-09-10 18:51:05 +1200
committertoofar <toofar@spalge.com>2022-09-10 20:48:39 +1200
commit6f8d7a7fbc6350b16046b832e8f5957b349245f2 (patch)
treeccd2616d43458a76d13291c5fbe28052bb0457c6
parent6f934d4a98f93e67a8f3c9e5c6708405e80179fd (diff)
downloadqutebrowser-6f8d7a7fbc6350b16046b832e8f5957b349245f2.tar.gz
qutebrowser-6f8d7a7fbc6350b16046b832e8f5957b349245f2.zip
Remove PySide2 imports.
We never supported PySide2 and by the time we get around to looking at any PySide version we'll likely be near to dropping Qt5 anyway. The main motivation however is avoiding, or being able to make use of, a quirk of pyright. When you import the same object from two different modules to the same attribute, and you don't have one of those modules installed, then pyright will tag the attribute with "Unknown". This affects us with the classes that got moved around between Qt5 and Qt6. Since we are importing them by name for both Qt5 backends then if you don't have one of them installed pyright will tag all those move classes as Unkown and you won't get autocompletion with them in VS Code. See https://github.com/qutebrowser/qutebrowser/issues/7370 for more details. mypy also has this issue (actually it's even worse there) but you can shortcut the ambiguouty by setting so called "compiled time constants" with the --always-true and --always-false command line arguments to make it not even consider some imports. pyright has a `defineConstant` setting for that too but it doesn't seem to apply to imports. I'll have to raise an issue with them...
-rw-r--r--qutebrowser/qt/core.py2
-rw-r--r--qutebrowser/qt/dbus.py2
-rw-r--r--qutebrowser/qt/gui.py4
-rw-r--r--qutebrowser/qt/machinery.py12
-rw-r--r--qutebrowser/qt/network.py2
-rw-r--r--qutebrowser/qt/opengl.py2
-rw-r--r--qutebrowser/qt/printsupport.py2
-rw-r--r--qutebrowser/qt/qml.py2
-rw-r--r--qutebrowser/qt/sip.py2
-rw-r--r--qutebrowser/qt/sql.py2
-rw-r--r--qutebrowser/qt/test.py2
-rw-r--r--qutebrowser/qt/webenginecore.py17
-rw-r--r--qutebrowser/qt/webenginewidgets.py2
-rw-r--r--qutebrowser/qt/webkit.py2
-rw-r--r--qutebrowser/qt/webkitwidgets.py2
-rw-r--r--qutebrowser/qt/widgets.py2
16 files changed, 4 insertions, 55 deletions
diff --git a/qutebrowser/qt/core.py b/qutebrowser/qt/core.py
index d29413c64..ab292c4f3 100644
--- a/qutebrowser/qt/core.py
+++ b/qutebrowser/qt/core.py
@@ -10,8 +10,6 @@ if machinery.USE_PYQT5:
from PyQt5.QtCore import *
elif machinery.USE_PYQT6:
from PyQt6.QtCore import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtCore import *
elif machinery.USE_PYSIDE6:
from PySide6.QtCore import *
else:
diff --git a/qutebrowser/qt/dbus.py b/qutebrowser/qt/dbus.py
index e257ba38b..4ef04d3cd 100644
--- a/qutebrowser/qt/dbus.py
+++ b/qutebrowser/qt/dbus.py
@@ -10,7 +10,5 @@ if machinery.USE_PYQT5:
from PyQt5.QtDBus import *
elif machinery.USE_PYQT6:
from PyQt6.QtDBus import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtDBus import *
elif machinery.USE_PYSIDE6:
from PySide6.QtDBus import *
diff --git a/qutebrowser/qt/gui.py b/qutebrowser/qt/gui.py
index 29a962541..7bb37089b 100644
--- a/qutebrowser/qt/gui.py
+++ b/qutebrowser/qt/gui.py
@@ -12,10 +12,6 @@ if machinery.USE_PYQT5:
del QOpenGLVersionProfile # moved to QtOpenGL in Qt 6
elif machinery.USE_PYQT6:
from PyQt6.QtGui import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtGui import *
- from PySide2.QtWidgets import QFileSystemModel
- del QOpenGLVersionProfile # moved to QtOpenGL in Qt 6
elif machinery.USE_PYSIDE6:
from PySide6.QtGui import *
else:
diff --git a/qutebrowser/qt/machinery.py b/qutebrowser/qt/machinery.py
index 0a2de9259..66a35a855 100644
--- a/qutebrowser/qt/machinery.py
+++ b/qutebrowser/qt/machinery.py
@@ -10,9 +10,8 @@ import importlib
_WRAPPERS = [
"PyQt6",
"PyQt5",
- # Need more work, PySide2 might not be usable at all
+ # Needs more work
# "PySide6",
- # "PySide2",
]
@@ -61,14 +60,13 @@ def _select_wrapper():
WRAPPER = _select_wrapper()
USE_PYQT5 = WRAPPER == "PyQt5"
USE_PYQT6 = WRAPPER == "PyQt6"
-USE_PYSIDE2 = WRAPPER == "PySide2"
USE_PYSIDE6 = WRAPPER == "PySide6"
-assert USE_PYQT5 ^ USE_PYQT6 ^ USE_PYSIDE2 ^ USE_PYSIDE6
+assert USE_PYQT5 ^ USE_PYQT6 ^ USE_PYSIDE6
-IS_QT5 = USE_PYQT5 or USE_PYSIDE2
+IS_QT5 = USE_PYQT5
IS_QT6 = USE_PYQT6 or USE_PYSIDE6
IS_PYQT = USE_PYQT5 or USE_PYQT6
-IS_PYSIDE = USE_PYSIDE2 or USE_PYSIDE6
+IS_PYSIDE = USE_PYSIDE6
assert IS_QT5 ^ IS_QT6
assert IS_PYQT ^ IS_PYSIDE
@@ -77,7 +75,5 @@ if USE_PYQT5:
PACKAGE = "PyQt5"
elif USE_PYQT6:
PACKAGE = "PyQt6"
-elif USE_PYSIDE2:
- PACKAGE = "PySide2"
elif USE_PYSIDE6:
PACKAGE = "PySide6"
diff --git a/qutebrowser/qt/network.py b/qutebrowser/qt/network.py
index ebb28561a..93dd14495 100644
--- a/qutebrowser/qt/network.py
+++ b/qutebrowser/qt/network.py
@@ -10,8 +10,6 @@ if machinery.USE_PYQT5:
from PyQt5.QtNetwork import *
elif machinery.USE_PYQT6:
from PyQt6.QtNetwork import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtNetwork import *
elif machinery.USE_PYSIDE6:
from PySide6.QtNetwork import *
else:
diff --git a/qutebrowser/qt/opengl.py b/qutebrowser/qt/opengl.py
index 4a61fbb95..7aaee3983 100644
--- a/qutebrowser/qt/opengl.py
+++ b/qutebrowser/qt/opengl.py
@@ -10,8 +10,6 @@ if machinery.USE_PYQT5:
from PyQt5.QtGui import QOpenGLVersionProfile
elif machinery.USE_PYQT6:
from PyQt6.QtOpenGL import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtGui import QOpenGLVersionProfile
elif machinery.USE_PYSIDE6:
from PySide6.QtOpenGL import *
else:
diff --git a/qutebrowser/qt/printsupport.py b/qutebrowser/qt/printsupport.py
index b0a244280..e4b6571a3 100644
--- a/qutebrowser/qt/printsupport.py
+++ b/qutebrowser/qt/printsupport.py
@@ -10,7 +10,5 @@ if machinery.USE_PYQT5:
from PyQt5.QtPrintSupport import *
elif machinery.USE_PYQT6:
from PyQt6.QtPrintSupport import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtPrintSupport import *
elif machinery.USE_PYSIDE6:
from PySide6.QtPrintSupport import *
diff --git a/qutebrowser/qt/qml.py b/qutebrowser/qt/qml.py
index 471a9051a..30ca7dc70 100644
--- a/qutebrowser/qt/qml.py
+++ b/qutebrowser/qt/qml.py
@@ -10,7 +10,5 @@ if machinery.USE_PYQT5:
from PyQt5.QtQml import *
elif machinery.USE_PYQT6:
from PyQt6.QtQml import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtQml import *
elif machinery.USE_PYSIDE6:
from PySide6.QtQml import *
diff --git a/qutebrowser/qt/sip.py b/qutebrowser/qt/sip.py
index 07682f24e..65139fdd3 100644
--- a/qutebrowser/qt/sip.py
+++ b/qutebrowser/qt/sip.py
@@ -18,8 +18,6 @@ elif machinery.USE_PYQT6:
from PyQt6.sip import *
except ImportError:
from sip import *
-elif machinery.USE_PYSIDE2:
- raise machinery.Unavailable()
elif machinery.USE_PYSIDE6:
raise machinery.Unavailable()
else:
diff --git a/qutebrowser/qt/sql.py b/qutebrowser/qt/sql.py
index 50a6b9d33..692a8b231 100644
--- a/qutebrowser/qt/sql.py
+++ b/qutebrowser/qt/sql.py
@@ -10,7 +10,5 @@ if machinery.USE_PYQT5:
from PyQt5.QtSql import *
elif machinery.USE_PYQT6:
from PyQt6.QtSql import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtSql import *
elif machinery.USE_PYSIDE6:
from PySide6.QtSql import *
diff --git a/qutebrowser/qt/test.py b/qutebrowser/qt/test.py
index 2d13107e9..0766f0ead 100644
--- a/qutebrowser/qt/test.py
+++ b/qutebrowser/qt/test.py
@@ -10,7 +10,5 @@ if machinery.USE_PYQT5:
from PyQt5.QtTest import *
elif machinery.USE_PYQT6:
from PyQt6.QtTest import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtTest import *
elif machinery.USE_PYSIDE6:
from PySide6.QtTest import *
diff --git a/qutebrowser/qt/webenginecore.py b/qutebrowser/qt/webenginecore.py
index 1a685cb96..d63ec1c70 100644
--- a/qutebrowser/qt/webenginecore.py
+++ b/qutebrowser/qt/webenginecore.py
@@ -22,26 +22,9 @@ if machinery.USE_PYQT5:
QWebEngineFullScreenRequest,
QWebEngineContextMenuData as QWebEngineContextMenuRequest,
)
- # FIXME:qt6 is there a PySide2 equivalent to those?
from PyQt5.QtWebEngine import PYQT_WEBENGINE_VERSION, PYQT_WEBENGINE_VERSION_STR
elif machinery.USE_PYQT6:
from PyQt6.QtWebEngineCore import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtWebEngineCore import *
- from PySide2.QtWebEngineWidgets import (
- QWebEngineSettings,
- QWebEngineProfile,
- QWebEngineDownloadItem as QWebEngineDownloadRequest,
- QWebEnginePage,
- QWebEngineCertificateError,
- QWebEngineScript,
- QWebEngineHistory,
- QWebEngineHistoryItem,
- QWebEngineScriptCollection,
- QWebEngineClientCertificateSelection,
- QWebEngineFullScreenRequest,
- QWebEngineContextMenuData as QWebEngineContextMenuRequest,
- )
elif machinery.USE_PYSIDE6:
from PySide6.QtWebEngineCore import *
else:
diff --git a/qutebrowser/qt/webenginewidgets.py b/qutebrowser/qt/webenginewidgets.py
index 27f422e45..aed7babe9 100644
--- a/qutebrowser/qt/webenginewidgets.py
+++ b/qutebrowser/qt/webenginewidgets.py
@@ -10,8 +10,6 @@ if machinery.USE_PYQT5:
from PyQt5.QtWebEngineWidgets import *
elif machinery.USE_PYQT6:
from PyQt6.QtWebEngineWidgets import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtWebEngineWidgets import *
elif machinery.USE_PYSIDE6:
from PySide6.QtWebEngineWidgets import *
else:
diff --git a/qutebrowser/qt/webkit.py b/qutebrowser/qt/webkit.py
index 3b098933f..10250714e 100644
--- a/qutebrowser/qt/webkit.py
+++ b/qutebrowser/qt/webkit.py
@@ -10,8 +10,6 @@ if machinery.USE_PYQT5:
from PyQt5.QtWebKit import *
elif machinery.USE_PYQT6:
raise machinery.Unavailable()
-elif machinery.USE_PYSIDE2:
- raise machinery.Unavailable()
elif machinery.USE_PYSIDE6:
raise machinery.Unavailable()
else:
diff --git a/qutebrowser/qt/webkitwidgets.py b/qutebrowser/qt/webkitwidgets.py
index 23ea42a8f..f8341e5cb 100644
--- a/qutebrowser/qt/webkitwidgets.py
+++ b/qutebrowser/qt/webkitwidgets.py
@@ -10,8 +10,6 @@ if machinery.USE_PYQT5:
from PyQt5.QtWebKitWidgets import *
elif machinery.USE_PYQT6:
raise machinery.Unavailable()
-elif machinery.USE_PYSIDE2:
- raise machinery.Unavailable()
elif machinery.USE_PYSIDE6:
raise machinery.Unavailable()
else:
diff --git a/qutebrowser/qt/widgets.py b/qutebrowser/qt/widgets.py
index 4b2cde488..d7ca04578 100644
--- a/qutebrowser/qt/widgets.py
+++ b/qutebrowser/qt/widgets.py
@@ -10,8 +10,6 @@ if machinery.USE_PYQT5:
from PyQt5.QtWidgets import *
elif machinery.USE_PYQT6:
from PyQt6.QtWidgets import *
-elif machinery.USE_PYSIDE2:
- from PySide2.QtWidgets import *
elif machinery.USE_PYSIDE6:
from PySide6.QtWidgets import *