diff: More work on images

This commit is contained in:
Kovid Goyal
2018-05-09 14:06:15 +05:30
parent 79dcc8c771
commit 2e69b904da
6 changed files with 102 additions and 6 deletions

View File

@@ -2,9 +2,10 @@
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import shutil
import warnings
from ..tui.images import can_display_images
class ImageSupportWarning(Warning):
pass
@@ -13,8 +14,7 @@ class ImageSupportWarning(Warning):
def images_supported():
ans = getattr(images_supported, 'ans', None)
if ans is None:
ans = shutil.which('convert') is not None
images_supported.ans = ans
images_supported.ans = ans = can_display_images()
if not ans:
warnings.warn('ImageMagick not found images cannot be displayed', ImageSupportWarning)
return ans