Files
macports-ports/python/py-Pillow/files/patch-ImageQt.py.diff

25 lines
879 B
Diff

--- src/PIL/ImageQt.py
+++ src/PIL/ImageQt.py
@@ -36,6 +36,8 @@ qt_version: str | None
qt_versions = [
["6", "PyQt6"],
["side6", "PySide6"],
+ ["5", "PyQt5"],
+ ["side2", "PySide2"],
]
# If a version has already been imported, attempt it first
@@ -53,6 +55,12 @@ for version, qt_module in qt_versions:
QIODevice,
)
from PySide6.QtGui import QImage, QPixmap, qRgba # type: ignore[assignment]
+ elif qt_module == "PyQt5":
+ from PyQt5.QtCore import QBuffer, QByteArray, QIODevice
+ from PyQt5.QtGui import QImage, QPixmap, qRgba
+ elif qt_module == "PySide2":
+ from PySide2.QtCore import QBuffer, QByteArray, QIODevice
+ from PySide2.QtGui import QImage, QPixmap, qRgba
except (ImportError, RuntimeError):
continue
qt_is_installed = True