mirror of
https://github.com/ihabunek/toot
synced 2024-12-22 23:08:17 +01:00
refac: tui: Optimize image pixel support detection
This commit is contained in:
parent
b97a995dc4
commit
efab6cf556
@ -10,6 +10,8 @@ try:
|
|||||||
from term_image import disable_queries # prevent phantom keystrokes
|
from term_image import disable_queries # prevent phantom keystrokes
|
||||||
from PIL import Image, ImageDraw
|
from PIL import Image, ImageDraw
|
||||||
|
|
||||||
|
_IMAGE_PIXEL_FORMATS = frozenset({'kitty', 'iterm'})
|
||||||
|
|
||||||
TuiScreen = UrwidImageScreen
|
TuiScreen = UrwidImageScreen
|
||||||
disable_queries()
|
disable_queries()
|
||||||
|
|
||||||
@ -17,7 +19,7 @@ try:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def can_render_pixels(image_format):
|
def can_render_pixels(image_format):
|
||||||
return image_format in ['kitty', 'iterm']
|
return image_format in _IMAGE_PIXEL_FORMATS
|
||||||
|
|
||||||
def get_base_image(image, image_format) -> BaseImage:
|
def get_base_image(image, image_format) -> BaseImage:
|
||||||
# we don't autodetect kitty, iterm; we choose based on option switches
|
# we don't autodetect kitty, iterm; we choose based on option switches
|
||||||
|
Loading…
Reference in New Issue
Block a user