1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-17 15:26:01 +00:00

display: move Image, Font and Animation code into components (#4967)

* display: move `Font` to `components/font`

* display: move `Animation` to `components/animation`

* display: move `Image` to `components/image`
This commit is contained in:
Kamil Trzciński
2023-06-25 00:56:29 +02:00
committed by GitHub
parent eb145757e5
commit 8a1c49a4ae
11 changed files with 55 additions and 47 deletions

View File

@@ -6,7 +6,7 @@ import re
import requests
from esphome import core
from esphome.components import display, font
from esphome.components import font
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.const import (
@@ -28,7 +28,9 @@ DOMAIN = "image"
DEPENDENCIES = ["display"]
MULTI_CONF = True
ImageType = display.display_ns.enum("ImageType")
image_ns = cg.esphome_ns.namespace("image")
ImageType = image_ns.enum("ImageType")
IMAGE_TYPE = {
"BINARY": ImageType.IMAGE_TYPE_BINARY,
"TRANSPARENT_BINARY": ImageType.IMAGE_TYPE_BINARY,
@@ -46,7 +48,7 @@ MDI_DOWNLOAD_TIMEOUT = 30 # seconds
SOURCE_LOCAL = "local"
SOURCE_MDI = "mdi"
Image_ = display.display_ns.class_("Image")
Image_ = image_ns.class_("Image")
def _compute_local_icon_path(value) -> Path: