diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2019-01-24 22:31:36 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2019-01-24 22:31:36 +0100 |
commit | 71ef2a362e95500c9c3b53ef967e54da65145b30 (patch) | |
tree | a3110aaf5cb513f291541e1c848c0d56b8df76fd | |
parent | d19046b5b1527eae73a90e3e5535950974d0c63f (diff) | |
download | poezio-71ef2a362e95500c9c3b53ef967e54da65145b30.tar.gz poezio-71ef2a362e95500c9c3b53ef967e54da65145b30.tar.bz2 poezio-71ef2a362e95500c9c3b53ef967e54da65145b30.tar.xz poezio-71ef2a362e95500c9c3b53ef967e54da65145b30.zip |
Add a stub Image class, to let poezio run even when Pillow isn’t installed.
-rw-r--r-- | poezio/windows/image.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/poezio/windows/image.py b/poezio/windows/image.py index e9a57f0b..71913e43 100644 --- a/poezio/windows/image.py +++ b/poezio/windows/image.py @@ -9,6 +9,9 @@ try: from PIL import Image HAS_PIL = True except ImportError: + class Image: + class Image: + pass HAS_PIL = False try: @@ -28,7 +31,7 @@ from poezio.config import config from typing import Tuple, Optional, Callable -def render_from_svg(svg: bytes) -> Optional[Image.Image]: +def render_svg(svg: bytes) -> Optional[Image.Image]: if not HAS_RSVG: return None try: @@ -79,7 +82,7 @@ class ImageWin(Win): except OSError: # TODO: Make the caller pass the MIME type, so we don’t # have to try all renderers like that. - image = render_from_svg(data) + image = render_svg(data) if image is None: raise except OSError: |