mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-28 21:13:41 +03:00
Use tuples
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
This commit is contained in:
parent
8b14a67347
commit
9c3bc70f66
|
@ -147,7 +147,7 @@ def grabclipboard():
|
||||||
else: # Session type check failed
|
else: # Session type check failed
|
||||||
session_type = None
|
session_type = None
|
||||||
|
|
||||||
if shutil.which("wl-paste") and session_type in ["wayland", None]:
|
if shutil.which("wl-paste") and session_type in ("wayland", None):
|
||||||
output = subprocess.check_output(["wl-paste", "-l"]).decode()
|
output = subprocess.check_output(["wl-paste", "-l"]).decode()
|
||||||
mimetypes = output.splitlines()
|
mimetypes = output.splitlines()
|
||||||
if "image/png" in mimetypes:
|
if "image/png" in mimetypes:
|
||||||
|
@ -160,7 +160,7 @@ def grabclipboard():
|
||||||
args = ["wl-paste"]
|
args = ["wl-paste"]
|
||||||
if mimetype:
|
if mimetype:
|
||||||
args.extend(["-t", mimetype])
|
args.extend(["-t", mimetype])
|
||||||
elif shutil.which("xclip") and session_type in ["x11", None]:
|
elif shutil.which("xclip") and session_type in ("x11", None):
|
||||||
args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
|
args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
|
||||||
else:
|
else:
|
||||||
msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux"
|
msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user