mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Deprecate support for Qt 5 (PyQt5 and PySide2). Use Qt 6 (PyQt6 or PySide6) instead.
This commit is contained in:
parent
de1ba373e1
commit
f854d7f7c9
|
@ -1,6 +1,12 @@
|
|||
import warnings
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import Image, ImageQt
|
||||
from PIL import Image
|
||||
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", category=DeprecationWarning)
|
||||
from PIL import ImageQt
|
||||
|
||||
from .helper import assert_image_equal, hopper
|
||||
|
||||
|
|
|
@ -2,10 +2,13 @@ import warnings
|
|||
|
||||
import pytest
|
||||
|
||||
from PIL import ImageQt
|
||||
|
||||
from .helper import assert_image_similar, hopper
|
||||
|
||||
with warnings.catch_warnings() as w:
|
||||
warnings.simplefilter("always", category=DeprecationWarning)
|
||||
from PIL import ImageQt
|
||||
|
||||
|
||||
pytestmark = pytest.mark.skipif(
|
||||
not ImageQt.qt_is_installed, reason="Qt bindings are not installed"
|
||||
)
|
||||
|
|
18
Tests/test_imageqt_deprecated.py
Normal file
18
Tests/test_imageqt_deprecated.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import warnings
|
||||
|
||||
|
||||
def test_deprecated():
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
# Arrange: cause all warnings to always be triggered
|
||||
warnings.simplefilter("always")
|
||||
|
||||
# Act: trigger a warning with Qt5
|
||||
from PIL import ImageQt
|
||||
|
||||
# Assert
|
||||
if ImageQt.qt_version in ("5", "side2"):
|
||||
assert len(w) == 1
|
||||
assert issubclass(w[0].category, DeprecationWarning)
|
||||
assert "deprecated" in str(w[0].message)
|
||||
else:
|
||||
assert len(w) == 0
|
|
@ -1,6 +1,10 @@
|
|||
import warnings
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import ImageQt
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", category=DeprecationWarning)
|
||||
from PIL import ImageQt
|
||||
|
||||
from .helper import assert_image_equal, assert_image_equal_tofile, hopper
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import warnings
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import ImageQt
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", category=DeprecationWarning)
|
||||
from PIL import ImageQt
|
||||
|
||||
from .helper import assert_image_equal, assert_image_equal_tofile, hopper
|
||||
|
||||
|
|
|
@ -142,13 +142,6 @@ The stub image plugin ``FitsStubImagePlugin`` has been deprecated and will be re
|
|||
Pillow 10.0.0 (2023-07-01). FITS images can be read without a handler through
|
||||
:mod:`~PIL.FitsImagePlugin` instead.
|
||||
|
||||
PhotoImage.paste box parameter
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 9.2.0
|
||||
|
||||
The ``box`` parameter is unused. It will be removed in Pillow 10.0.0 (2023-07-01).
|
||||
|
||||
FreeTypeFont.getmask2 fill parameter
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
@ -157,6 +150,26 @@ FreeTypeFont.getmask2 fill parameter
|
|||
The undocumented ``fill`` parameter of :py:meth:`.FreeTypeFont.getmask2` has been
|
||||
deprecated and will be removed in Pillow 10 (2023-07-01).
|
||||
|
||||
PhotoImage.paste box parameter
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 9.2.0
|
||||
|
||||
The ``box`` parameter is unused. It will be removed in Pillow 10.0.0 (2023-07-01).
|
||||
|
||||
PyQt5 and PySide2
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
.. deprecated:: 9.2.0
|
||||
|
||||
`Qt 5 reached end-of-life <https://www.qt.io/blog/qt-5.15-released>`_ on 2020-12-08 for
|
||||
open-source users (and will reach EOL on 2023-12-08 for commercial licence holders).
|
||||
|
||||
Support for PyQt5 and PySide2 has been deprecated from ``ImageQt`` and will be removed
|
||||
in Pillow 10 (2023-07-01). Upgrade to
|
||||
`PyQt6 <https://www.riverbankcomputing.com/static/Docs/PyQt6/>`_ or
|
||||
`PySide6 <https://doc.qt.io/qtforpython/>`_ instead.
|
||||
|
||||
Removed features
|
||||
----------------
|
||||
|
||||
|
|
|
@ -7,6 +7,14 @@
|
|||
The :py:mod:`~PIL.ImageQt` module contains support for creating PyQt6, PySide6, PyQt5
|
||||
or PySide2 QImage objects from PIL images.
|
||||
|
||||
`Qt 5 reached end-of-life <https://www.qt.io/blog/qt-5.15-released>`_ on 2020-12-08 for
|
||||
open-source users (and will reach EOL on 2023-12-08 for commercial licence holders).
|
||||
|
||||
Support for PyQt5 and PySide2 has been deprecated from ``ImageQt`` and will be removed
|
||||
in Pillow 10 (2023-07-01). Upgrade to
|
||||
`PyQt6 <https://www.riverbankcomputing.com/static/Docs/PyQt6/>`_ or
|
||||
`PySide6 <https://doc.qt.io/qtforpython/>`_ instead.
|
||||
|
||||
.. versionadded:: 1.1.6
|
||||
|
||||
.. py:class:: ImageQt(image)
|
||||
|
|
|
@ -10,9 +10,24 @@ TODO
|
|||
Deprecations
|
||||
============
|
||||
|
||||
PyQt5 and PySide2
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. deprecated:: 9.2.0
|
||||
|
||||
`Qt 5 reached end-of-life <https://www.qt.io/blog/qt-5.15-released>`_ on 2020-12-08 for
|
||||
open-source users (and will reach EOL on 2023-12-08 for commercial licence holders).
|
||||
|
||||
Support for PyQt5 and PySide2 has been deprecated from ``ImageQt`` and will be removed
|
||||
in Pillow 10 (2023-07-01). Upgrade to
|
||||
`PyQt6 <https://www.riverbankcomputing.com/static/Docs/PyQt6/>`_ or
|
||||
`PySide6 <https://doc.qt.io/qtforpython/>`_ instead.
|
||||
|
||||
FreeTypeFont.getmask2 fill parameter
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
.. deprecated:: 9.2.0
|
||||
|
||||
The undocumented ``fill`` parameter of :py:meth:`.FreeTypeFont.getmask2`
|
||||
has been deprecated and will be removed in Pillow 10 (2023-07-01).
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import sys
|
|||
from io import BytesIO
|
||||
|
||||
from . import Image
|
||||
from ._deprecate import deprecate
|
||||
from ._util import is_path
|
||||
|
||||
qt_versions = [
|
||||
|
@ -42,9 +43,13 @@ for qt_version, qt_module in qt_versions:
|
|||
elif qt_module == "PyQt5":
|
||||
from PyQt5.QtCore import QBuffer, QIODevice
|
||||
from PyQt5.QtGui import QImage, QPixmap, qRgba
|
||||
|
||||
deprecate("Support for PyQt5", 10, "PyQt6 or PySide6")
|
||||
elif qt_module == "PySide2":
|
||||
from PySide2.QtCore import QBuffer, QIODevice
|
||||
from PySide2.QtGui import QImage, QPixmap, qRgba
|
||||
|
||||
deprecate("Support for PySide2", 10, "PyQt6 or PySide6")
|
||||
except (ImportError, RuntimeError):
|
||||
continue
|
||||
qt_is_installed = True
|
||||
|
|
Loading…
Reference in New Issue
Block a user