mirror of
https://github.com/kovidgoyal/kitty.git
synced 2024-09-11 14:45:31 +03:00
Add Lenna to the test dir so the gr.py script becomes self-sufficient
This commit is contained in:
parent
02dc637ed0
commit
192b16e9ff
BIN
kitty_tests/Lenna.png
Normal file
BIN
kitty_tests/Lenna.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 463 KiB |
@ -3,7 +3,6 @@
|
||||
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import zlib
|
||||
from base64 import standard_b64encode
|
||||
@ -40,6 +39,15 @@ def display(data, width, height, x, y, z, ncols=0, nrows=0):
|
||||
cmd.clear()
|
||||
|
||||
|
||||
def display_png_file(path):
|
||||
cmd = {'a': 'T', 't': 'f', 'f': '100'}
|
||||
path = os.path.abspath(path)
|
||||
if not isinstance(path, bytes):
|
||||
path = path.encode(sys.getfilesystemencoding() or 'utf-8')
|
||||
data = standard_b64encode(path)
|
||||
write_gr_cmd(cmd, data)
|
||||
|
||||
|
||||
def main():
|
||||
clear_screen()
|
||||
display(b'\xdd\xdd\xdd\xff', 1, 1, 0, 0, -10, 40, 20)
|
||||
@ -48,14 +56,17 @@ def main():
|
||||
move_cursor(5, 8)
|
||||
print('kitty is \033[3m\033[32mawesome\033[m!')
|
||||
move_cursor(0, 21)
|
||||
if os.path.exists('/t/Lenna.png'):
|
||||
print('Lenna...')
|
||||
subprocess.check_call('python3 kitty/icat.py /t/Lenna.png'.split())
|
||||
print('Lenna...')
|
||||
display_png_file('kitty_tests/Lenna.png')
|
||||
try:
|
||||
raw_input()
|
||||
except NameError:
|
||||
input()
|
||||
try:
|
||||
raw_input()
|
||||
except NameError:
|
||||
input()
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.chdir(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user