diff: Start work on image display

This commit is contained in:
Kovid Goyal
2018-05-09 10:25:53 +05:30
parent e07d216a11
commit d51a424b98
3 changed files with 55 additions and 5 deletions

20
kittens/diff/images.py Normal file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import shutil
import warnings
class ImageSupportWarning(Warning):
pass
def images_supported():
ans = getattr(images_supported, 'ans', None)
if ans is None:
ans = shutil.which('convert') is not None
images_supported.ans = ans
if not ans:
warnings.warn('ImageMagick not found images cannot be displayed', ImageSupportWarning)
return ans