mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-23 19:44:13 +03:00
Merge pull request #5897 from m-shinder/main
Added ImageShow support for xdg-open
This commit is contained in:
commit
1510efb647
|
@ -17,6 +17,7 @@ All default viewers convert the image to be shown to PNG format.
|
||||||
|
|
||||||
The following viewers may be registered on Unix-based systems, if the given command is found:
|
The following viewers may be registered on Unix-based systems, if the given command is found:
|
||||||
|
|
||||||
|
.. autoclass:: PIL.ImageShow.XDGViewer
|
||||||
.. autoclass:: PIL.ImageShow.DisplayViewer
|
.. autoclass:: PIL.ImageShow.DisplayViewer
|
||||||
.. autoclass:: PIL.ImageShow.GmDisplayViewer
|
.. autoclass:: PIL.ImageShow.GmDisplayViewer
|
||||||
.. autoclass:: PIL.ImageShow.EogViewer
|
.. autoclass:: PIL.ImageShow.EogViewer
|
||||||
|
|
|
@ -186,6 +186,16 @@ class UnixViewer(Viewer):
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
class XDGViewer(UnixViewer):
|
||||||
|
"""
|
||||||
|
The freedesktop.org ``xdg-open`` command.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def get_command_ex(self, file, **options):
|
||||||
|
command = executable = "xdg-open"
|
||||||
|
return command, executable
|
||||||
|
|
||||||
|
|
||||||
class DisplayViewer(UnixViewer):
|
class DisplayViewer(UnixViewer):
|
||||||
"""
|
"""
|
||||||
The ImageMagick ``display`` command.
|
The ImageMagick ``display`` command.
|
||||||
|
@ -233,6 +243,8 @@ class XVViewer(UnixViewer):
|
||||||
|
|
||||||
|
|
||||||
if sys.platform not in ("win32", "darwin"): # unixoids
|
if sys.platform not in ("win32", "darwin"): # unixoids
|
||||||
|
if shutil.which("xdg-open"):
|
||||||
|
register(XDGViewer)
|
||||||
if shutil.which("display"):
|
if shutil.which("display"):
|
||||||
register(DisplayViewer)
|
register(DisplayViewer)
|
||||||
if shutil.which("gm"):
|
if shutil.which("gm"):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user