mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-05-29 18:23:24 +03:00
Merge pull request #4108 from hugovk/rm-deprecated-qt
Drop support for EOL PyQt4 and PySide
This commit is contained in:
commit
e8cf9a6bc1
|
@ -24,9 +24,6 @@ matrix:
|
||||||
name: "3.7 Xenial"
|
name: "3.7 Xenial"
|
||||||
- python: '2.7'
|
- python: '2.7'
|
||||||
name: "2.7 Xenial"
|
name: "2.7 Xenial"
|
||||||
- python: "2.7_with_system_site_packages" # For PyQt4
|
|
||||||
name: "2.7_with_system_site_packages Xenial"
|
|
||||||
services: xvfb
|
|
||||||
- python: '3.6'
|
- python: '3.6'
|
||||||
name: "3.6 Xenial PYTHONOPTIMIZE=1"
|
name: "3.6 Xenial PYTHONOPTIMIZE=1"
|
||||||
env: PYTHONOPTIMIZE=1
|
env: PYTHONOPTIMIZE=1
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-tk python-qt4\
|
sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-tk\
|
||||||
ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\
|
ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\
|
||||||
cmake imagemagick libharfbuzz-dev libfribidi-dev
|
cmake imagemagick libharfbuzz-dev libfribidi-dev
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,7 @@
|
||||||
import sys
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
from PIL import ImageQt
|
from PIL import ImageQt
|
||||||
|
|
||||||
from .helper import PillowTestCase, hopper
|
from .helper import PillowTestCase, hopper
|
||||||
|
|
||||||
if sys.version_info.major >= 3:
|
|
||||||
from importlib import reload
|
|
||||||
|
|
||||||
if ImageQt.qt_is_installed:
|
if ImageQt.qt_is_installed:
|
||||||
from PIL.ImageQt import qRgba
|
from PIL.ImageQt import qRgba
|
||||||
|
|
||||||
|
@ -35,10 +29,6 @@ class PillowQPixmapTestCase(PillowQtTestCase):
|
||||||
try:
|
try:
|
||||||
if ImageQt.qt_version == "5":
|
if ImageQt.qt_version == "5":
|
||||||
from PyQt5.QtGui import QGuiApplication
|
from PyQt5.QtGui import QGuiApplication
|
||||||
elif ImageQt.qt_version == "4":
|
|
||||||
from PyQt4.QtGui import QGuiApplication
|
|
||||||
elif ImageQt.qt_version == "side":
|
|
||||||
from PySide.QtGui import QGuiApplication
|
|
||||||
elif ImageQt.qt_version == "side2":
|
elif ImageQt.qt_version == "side2":
|
||||||
from PySide2.QtGui import QGuiApplication
|
from PySide2.QtGui import QGuiApplication
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -59,10 +49,6 @@ class TestImageQt(PillowQtTestCase, PillowTestCase):
|
||||||
# equivalent to an unsigned int.
|
# equivalent to an unsigned int.
|
||||||
if ImageQt.qt_version == "5":
|
if ImageQt.qt_version == "5":
|
||||||
from PyQt5.QtGui import qRgb
|
from PyQt5.QtGui import qRgb
|
||||||
elif ImageQt.qt_version == "4":
|
|
||||||
from PyQt4.QtGui import qRgb
|
|
||||||
elif ImageQt.qt_version == "side":
|
|
||||||
from PySide.QtGui import qRgb
|
|
||||||
elif ImageQt.qt_version == "side2":
|
elif ImageQt.qt_version == "side2":
|
||||||
from PySide2.QtGui import qRgb
|
from PySide2.QtGui import qRgb
|
||||||
|
|
||||||
|
@ -83,13 +69,3 @@ class TestImageQt(PillowQtTestCase, PillowTestCase):
|
||||||
def test_image(self):
|
def test_image(self):
|
||||||
for mode in ("1", "RGB", "RGBA", "L", "P"):
|
for mode in ("1", "RGB", "RGBA", "L", "P"):
|
||||||
ImageQt.ImageQt(hopper(mode))
|
ImageQt.ImageQt(hopper(mode))
|
||||||
|
|
||||||
def test_deprecated(self):
|
|
||||||
with warnings.catch_warnings(record=True) as w:
|
|
||||||
reload(ImageQt)
|
|
||||||
if ImageQt.qt_version in ["4", "side"]:
|
|
||||||
self.assertEqual(len(w), 1)
|
|
||||||
self.assertTrue(issubclass(w[-1].category, DeprecationWarning))
|
|
||||||
else:
|
|
||||||
# No warning.
|
|
||||||
self.assertEqual(w, [])
|
|
||||||
|
|
|
@ -9,26 +9,10 @@ if ImageQt.qt_is_installed:
|
||||||
try:
|
try:
|
||||||
from PyQt5 import QtGui
|
from PyQt5 import QtGui
|
||||||
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QApplication
|
from PyQt5.QtWidgets import QWidget, QHBoxLayout, QLabel, QApplication
|
||||||
|
|
||||||
QT_VERSION = 5
|
|
||||||
except (ImportError, RuntimeError):
|
except (ImportError, RuntimeError):
|
||||||
try:
|
|
||||||
from PySide2 import QtGui
|
from PySide2 import QtGui
|
||||||
from PySide2.QtWidgets import QWidget, QHBoxLayout, QLabel, QApplication
|
from PySide2.QtWidgets import QWidget, QHBoxLayout, QLabel, QApplication
|
||||||
|
|
||||||
QT_VERSION = 5
|
|
||||||
except (ImportError, RuntimeError):
|
|
||||||
try:
|
|
||||||
from PyQt4 import QtGui
|
|
||||||
from PyQt4.QtGui import QWidget, QHBoxLayout, QLabel, QApplication
|
|
||||||
|
|
||||||
QT_VERSION = 4
|
|
||||||
except (ImportError, RuntimeError):
|
|
||||||
from PySide import QtGui
|
|
||||||
from PySide.QtGui import QWidget, QHBoxLayout, QLabel, QApplication
|
|
||||||
|
|
||||||
QT_VERSION = 4
|
|
||||||
|
|
||||||
|
|
||||||
class TestToQImage(PillowQtTestCase, PillowTestCase):
|
class TestToQImage(PillowQtTestCase, PillowTestCase):
|
||||||
def test_sanity(self):
|
def test_sanity(self):
|
||||||
|
@ -60,10 +44,6 @@ class TestToQImage(PillowQtTestCase, PillowTestCase):
|
||||||
|
|
||||||
# Check that it actually worked.
|
# Check that it actually worked.
|
||||||
reloaded = Image.open(tempfile)
|
reloaded = Image.open(tempfile)
|
||||||
# Gray images appear to come back in palette mode.
|
|
||||||
# They're roughly equivalent
|
|
||||||
if QT_VERSION == 4 and mode == "L":
|
|
||||||
src = src.convert("P")
|
|
||||||
self.assert_image_equal(reloaded, src)
|
self.assert_image_equal(reloaded, src)
|
||||||
|
|
||||||
def test_segfault(self):
|
def test_segfault(self):
|
||||||
|
|
|
@ -45,17 +45,6 @@ Python 2.7 reaches end-of-life on 2020-01-01.
|
||||||
Pillow 7.0.0 will be released on 2020-01-01 and will drop support for Python 2.7, making
|
Pillow 7.0.0 will be released on 2020-01-01 and will drop support for Python 2.7, making
|
||||||
Pillow 6.x the last series to support Python 2.
|
Pillow 6.x the last series to support Python 2.
|
||||||
|
|
||||||
PyQt4 and PySide
|
|
||||||
~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 6.0.0
|
|
||||||
|
|
||||||
Qt 4 reached end-of-life on 2015-12-19. Its Python bindings are also EOL: PyQt4 since
|
|
||||||
2018-08-31 and PySide since 2015-10-14.
|
|
||||||
|
|
||||||
Support for PyQt4 and PySide has been deprecated from ``ImageQt`` and will be removed in
|
|
||||||
a future version. Please upgrade to PyQt5 or PySide2.
|
|
||||||
|
|
||||||
PIL.*ImagePlugin.__version__ attributes
|
PIL.*ImagePlugin.__version__ attributes
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -114,6 +103,17 @@ PILLOW_VERSION constant
|
||||||
|
|
||||||
``PILLOW_VERSION`` has been removed. Use ``__version__`` instead.
|
``PILLOW_VERSION`` has been removed. Use ``__version__`` instead.
|
||||||
|
|
||||||
|
PyQt4 and PySide
|
||||||
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
*Removed in version 7.0.0.*
|
||||||
|
|
||||||
|
Qt 4 reached end-of-life on 2015-12-19. Its Python bindings are also EOL: PyQt4 since
|
||||||
|
2018-08-31 and PySide since 2015-10-14.
|
||||||
|
|
||||||
|
Support for PyQt4 and PySide has been removed from ``ImageQt``. Please upgrade to PyQt5
|
||||||
|
or PySide2.
|
||||||
|
|
||||||
Setting the size of TIFF images
|
Setting the size of TIFF images
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
|
@ -4,14 +4,8 @@
|
||||||
:py:mod:`ImageQt` Module
|
:py:mod:`ImageQt` Module
|
||||||
========================
|
========================
|
||||||
|
|
||||||
The :py:mod:`ImageQt` module contains support for creating PyQt4, PyQt5, PySide or
|
The :py:mod:`ImageQt` module contains support for creating PyQt5 or PySide2 QImage
|
||||||
PySide2 QImage objects from PIL images.
|
objects from PIL images.
|
||||||
|
|
||||||
Qt 4 reached end-of-life on 2015-12-19. Its Python bindings are also EOL: PyQt4 since
|
|
||||||
2018-08-31 and PySide since 2015-10-14.
|
|
||||||
|
|
||||||
Support for PyQt4 and PySide is deprecated since Pillow 6.0.0 and will be removed in a
|
|
||||||
future version. Please upgrade to PyQt5 or PySide2.
|
|
||||||
|
|
||||||
.. versionadded:: 1.1.6
|
.. versionadded:: 1.1.6
|
||||||
|
|
||||||
|
@ -20,7 +14,7 @@ future version. Please upgrade to PyQt5 or PySide2.
|
||||||
Creates an :py:class:`~PIL.ImageQt.ImageQt` object from a PIL
|
Creates an :py:class:`~PIL.ImageQt.ImageQt` object from a PIL
|
||||||
:py:class:`~PIL.Image.Image` object. This class is a subclass of
|
:py:class:`~PIL.Image.Image` object. This class is a subclass of
|
||||||
QtGui.QImage, which means that you can pass the resulting objects directly
|
QtGui.QImage, which means that you can pass the resulting objects directly
|
||||||
to PyQt4/PyQt5/PySide API functions and methods.
|
to PyQt5/PySide2 API functions and methods.
|
||||||
|
|
||||||
This operation is currently supported for mode 1, L, P, RGB, and RGBA
|
This operation is currently supported for mode 1, L, P, RGB, and RGBA
|
||||||
images. To handle other modes, you need to convert the image first.
|
images. To handle other modes, you need to convert the image first.
|
||||||
|
|
|
@ -17,18 +17,12 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from . import Image
|
from . import Image
|
||||||
from ._util import isPath, py3
|
from ._util import isPath, py3
|
||||||
|
|
||||||
qt_versions = [["5", "PyQt5"], ["side2", "PySide2"], ["4", "PyQt4"], ["side", "PySide"]]
|
qt_versions = [["5", "PyQt5"], ["side2", "PySide2"]]
|
||||||
|
|
||||||
WARNING_TEXT = (
|
|
||||||
"Support for EOL {} is deprecated and will be removed in a future version. "
|
|
||||||
"Please upgrade to PyQt5 or PySide2."
|
|
||||||
)
|
|
||||||
|
|
||||||
# If a version has already been imported, attempt it first
|
# If a version has already been imported, attempt it first
|
||||||
qt_versions.sort(key=lambda qt_version: qt_version[1] in sys.modules, reverse=True)
|
qt_versions.sort(key=lambda qt_version: qt_version[1] in sys.modules, reverse=True)
|
||||||
|
@ -40,16 +34,6 @@ for qt_version, qt_module in qt_versions:
|
||||||
elif qt_module == "PySide2":
|
elif qt_module == "PySide2":
|
||||||
from PySide2.QtGui import QImage, qRgba, QPixmap
|
from PySide2.QtGui import QImage, qRgba, QPixmap
|
||||||
from PySide2.QtCore import QBuffer, QIODevice
|
from PySide2.QtCore import QBuffer, QIODevice
|
||||||
elif qt_module == "PyQt4":
|
|
||||||
from PyQt4.QtGui import QImage, qRgba, QPixmap
|
|
||||||
from PyQt4.QtCore import QBuffer, QIODevice
|
|
||||||
|
|
||||||
warnings.warn(WARNING_TEXT.format(qt_module), DeprecationWarning)
|
|
||||||
elif qt_module == "PySide":
|
|
||||||
from PySide.QtGui import QImage, qRgba, QPixmap
|
|
||||||
from PySide.QtCore import QBuffer, QIODevice
|
|
||||||
|
|
||||||
warnings.warn(WARNING_TEXT.format(qt_module), DeprecationWarning)
|
|
||||||
except (ImportError, RuntimeError):
|
except (ImportError, RuntimeError):
|
||||||
continue
|
continue
|
||||||
qt_is_installed = True
|
qt_is_installed = True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user