Removed Image._showxv

This commit is contained in:
Andrew Murray 2021-10-18 10:53:48 +11:00
parent e444e7ab6d
commit 499040491b
4 changed files with 17 additions and 39 deletions

View File

@ -626,22 +626,6 @@ class TestImage:
expected = Image.new(mode, (100, 100), color)
assert_image_equal(im.convert(mode), expected)
def test_showxv_deprecation(self):
class TestViewer(ImageShow.Viewer):
def show_image(self, image, **options):
return True
viewer = TestViewer()
ImageShow.register(viewer, -1)
im = Image.new("RGB", (50, 50), "white")
with pytest.warns(DeprecationWarning):
Image._showxv(im)
# Restore original state
ImageShow._viewers.pop(0)
def test_no_resource_warning_on_save(self, tmp_path):
# https://github.com/python-pillow/Pillow/issues/835
# Arrange

View File

@ -33,15 +33,6 @@ Image.show command parameter
The ``command`` parameter will be removed in Pillow 9.0.0 (2022-01-02).
Use a subclass of :py:class:`.ImageShow.Viewer` instead.
Image._showxv
~~~~~~~~~~~~~
.. deprecated:: 7.2.0
``Image._showxv`` will be removed in Pillow 9.0.0 (2022-01-02).
Use :py:meth:`.Image.Image.show` instead. If custom behaviour is required, use
:py:func:`.ImageShow.register` to add a custom :py:class:`.ImageShow.Viewer` class.
Tk/Tcl 8.4
~~~~~~~~~~
@ -89,6 +80,15 @@ Removed features
Deprecated features are only removed in major releases after an appropriate
period of deprecation has passed.
Image._showxv
~~~~~~~~~~~~~
.. deprecated:: 7.2.0
.. versionremoved:: 9.0.0
Use :py:meth:`.Image.Image.show` instead. If custom behaviour is required, use
:py:func:`.ImageShow.register` to add a custom :py:class:`.ImageShow.Viewer` class.
ImageFile.raise_ioerror
~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -14,3 +14,10 @@ ImageFile.raise_ioerror
``IOError`` was merged into ``OSError`` in Python 3.3. So, ``ImageFile.raise_ioerror``
has been removed. Use ``ImageFile.raise_oserror`` instead.
Image._showxv
~~~~~~~~~~~~~
``Image._showxv`` has been removed. Use :py:meth:`~PIL.Image.Image.show`
instead. If custom behaviour is required, use :py:meth:`~PIL.ImageShow.register` to add
a custom :py:class:`~PIL.ImageShow.Viewer` class.

View File

@ -3233,22 +3233,9 @@ def register_encoder(name, encoder):
def _show(image, **options):
options["_internal_pillow"] = True
_showxv(image, **options)
def _showxv(image, title=None, **options):
from . import ImageShow
if "_internal_pillow" in options:
del options["_internal_pillow"]
else:
warnings.warn(
"_showxv is deprecated and will be removed in Pillow 9 (2022-01-02). "
"Use Image.show instead.",
DeprecationWarning,
)
ImageShow.show(image, title, **options)
ImageShow.show(image, **options)
# --------------------------------------------------------------------