mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 22:48:10 +01:00
Move CONF_ITEMS/CONF_FONT/CONF_TEXT to const.py (#7204)
This commit is contained in:
parent
455df35e50
commit
8667f51cf0
12 changed files with 34 additions and 32 deletions
|
@ -1,23 +1,26 @@
|
|||
import re
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
|
||||
from esphome import automation, core
|
||||
from esphome.automation import maybe_simple_id
|
||||
import esphome.codegen as cg
|
||||
from esphome.components.number import Number
|
||||
from esphome.components.select import Select
|
||||
from esphome.components.switch import Switch
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_ID,
|
||||
CONF_TYPE,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_ON_VALUE,
|
||||
CONF_ACTIVE,
|
||||
CONF_COMMAND,
|
||||
CONF_CUSTOM,
|
||||
CONF_NUMBER,
|
||||
CONF_FORMAT,
|
||||
CONF_ID,
|
||||
CONF_ITEMS,
|
||||
CONF_MODE,
|
||||
CONF_ACTIVE,
|
||||
CONF_NUMBER,
|
||||
CONF_ON_VALUE,
|
||||
CONF_TEXT,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_TYPE,
|
||||
)
|
||||
from esphome.automation import maybe_simple_id
|
||||
from esphome.components.select import Select
|
||||
from esphome.components.number import Number
|
||||
from esphome.components.switch import Switch
|
||||
|
||||
CODEOWNERS = ["@numo68"]
|
||||
|
||||
|
@ -29,10 +32,8 @@ CONF_JOYSTICK = "joystick"
|
|||
CONF_LABEL = "label"
|
||||
CONF_MENU = "menu"
|
||||
CONF_BACK = "back"
|
||||
CONF_TEXT = "text"
|
||||
CONF_SELECT = "select"
|
||||
CONF_SWITCH = "switch"
|
||||
CONF_ITEMS = "items"
|
||||
CONF_ON_TEXT = "on_text"
|
||||
CONF_OFF_TEXT = "off_text"
|
||||
CONF_VALUE_LAMBDA = "value_lambda"
|
||||
|
|
|
@ -10,12 +10,12 @@ import esphome.config_validation as cv
|
|||
from esphome.const import (
|
||||
CONF_BACKGROUND_COLOR,
|
||||
CONF_DISPLAY,
|
||||
CONF_FONT,
|
||||
CONF_FOREGROUND_COLOR,
|
||||
CONF_ID,
|
||||
CONF_TRIGGER_ID,
|
||||
)
|
||||
|
||||
CONF_FONT = "font"
|
||||
CONF_MENU_ITEM_VALUE = "menu_item_value"
|
||||
CONF_ON_REDRAW = "on_redraw"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ Constants already defined in esphome.const are not duplicated here and must be i
|
|||
"""
|
||||
|
||||
from esphome import codegen as cg, config_validation as cv
|
||||
from esphome.const import CONF_ITEMS
|
||||
from esphome.core import ID, Lambda
|
||||
from esphome.cpp_generator import MockObj
|
||||
from esphome.cpp_types import uint32
|
||||
|
@ -115,7 +116,6 @@ CONF_SCROLLBAR = "scrollbar"
|
|||
CONF_INDICATOR = "indicator"
|
||||
CONF_KNOB = "knob"
|
||||
CONF_SELECTED = "selected"
|
||||
CONF_ITEMS = "items"
|
||||
CONF_TICKS = "ticks"
|
||||
CONF_CURSOR = "cursor"
|
||||
CONF_TEXTAREA_PLACEHOLDER = "textarea_placeholder"
|
||||
|
@ -460,7 +460,6 @@ CONF_SKIP = "skip"
|
|||
CONF_SYMBOL = "symbol"
|
||||
CONF_TAB_ID = "tab_id"
|
||||
CONF_TABS = "tabs"
|
||||
CONF_TEXT = "text"
|
||||
CONF_TILE = "tile"
|
||||
CONF_TILE_ID = "tile_id"
|
||||
CONF_TILES = "tiles"
|
||||
|
|
|
@ -7,6 +7,7 @@ from esphome.const import (
|
|||
CONF_ID,
|
||||
CONF_ON_VALUE,
|
||||
CONF_STATE,
|
||||
CONF_TEXT,
|
||||
CONF_TRIGGER_ID,
|
||||
CONF_TYPE,
|
||||
)
|
||||
|
@ -25,7 +26,7 @@ WIDGET_TYPES: dict = {}
|
|||
# A schema for text properties
|
||||
TEXT_SCHEMA = cv.Schema(
|
||||
{
|
||||
cv.Optional(df.CONF_TEXT): cv.Any(
|
||||
cv.Optional(CONF_TEXT): cv.Any(
|
||||
cv.All(
|
||||
cv.Schema(
|
||||
{
|
||||
|
@ -330,7 +331,7 @@ DISP_BG_SCHEMA = cv.Schema(
|
|||
|
||||
# A style schema that can include text
|
||||
STYLED_TEXT_SCHEMA = cv.maybe_simple_value(
|
||||
STYLE_SCHEMA.extend(TEXT_SCHEMA), key=df.CONF_TEXT
|
||||
STYLE_SCHEMA.extend(TEXT_SCHEMA), key=CONF_TEXT
|
||||
)
|
||||
|
||||
# For use by platform components
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import sys
|
||||
|
||||
from esphome import automation, codegen as cg
|
||||
from esphome.const import CONF_MAX_VALUE, CONF_MIN_VALUE, CONF_VALUE
|
||||
from esphome.const import CONF_MAX_VALUE, CONF_MIN_VALUE, CONF_TEXT, CONF_VALUE
|
||||
from esphome.cpp_generator import MockObj, MockObjClass
|
||||
|
||||
from .defines import CONF_TEXT, lvgl_ns
|
||||
from .defines import lvgl_ns
|
||||
from .lvcode import lv_expr
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ from esphome import automation
|
|||
import esphome.codegen as cg
|
||||
from esphome.components.key_provider import KeyProvider
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_ID, CONF_WIDTH
|
||||
from esphome.const import CONF_ID, CONF_ITEMS, CONF_TEXT, CONF_WIDTH
|
||||
from esphome.cpp_generator import MockObj
|
||||
|
||||
from ..automation import action_to_code
|
||||
|
@ -10,13 +10,11 @@ from ..defines import (
|
|||
BUTTONMATRIX_CTRLS,
|
||||
CONF_BUTTONS,
|
||||
CONF_CONTROL,
|
||||
CONF_ITEMS,
|
||||
CONF_KEY_CODE,
|
||||
CONF_MAIN,
|
||||
CONF_ONE_CHECKED,
|
||||
CONF_ROWS,
|
||||
CONF_SELECTED,
|
||||
CONF_TEXT,
|
||||
)
|
||||
from ..helpers import lvgl_components_required
|
||||
from ..lv_validation import key_code, lv_bool
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
from ..defines import CONF_INDICATOR, CONF_MAIN, CONF_TEXT
|
||||
from esphome.const import CONF_TEXT
|
||||
|
||||
from ..defines import CONF_INDICATOR, CONF_MAIN
|
||||
from ..lv_validation import lv_text
|
||||
from ..lvcode import lv
|
||||
from ..schemas import TEXT_SCHEMA
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from esphome.components.key_provider import KeyProvider
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_MODE
|
||||
from esphome.const import CONF_ITEMS, CONF_MODE
|
||||
from esphome.cpp_types import std_string
|
||||
|
||||
from ..defines import CONF_ITEMS, CONF_MAIN, KEYBOARD_MODES, literal
|
||||
from ..defines import CONF_MAIN, KEYBOARD_MODES, literal
|
||||
from ..helpers import add_lv_use, lvgl_components_required
|
||||
from ..types import LvCompound, LvType
|
||||
from . import Widget, WidgetType, get_widgets
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_TEXT
|
||||
|
||||
from ..defines import (
|
||||
CONF_LONG_MODE,
|
||||
|
@ -6,7 +7,6 @@ from ..defines import (
|
|||
CONF_RECOLOR,
|
||||
CONF_SCROLLBAR,
|
||||
CONF_SELECTED,
|
||||
CONF_TEXT,
|
||||
LV_LONG_MODES,
|
||||
)
|
||||
from ..lv_validation import lv_bool, lv_text
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from esphome import config_validation as cv
|
||||
from esphome.const import CONF_BUTTON, CONF_ID
|
||||
from esphome.const import CONF_BUTTON, CONF_ID, CONF_TEXT
|
||||
from esphome.core import ID
|
||||
from esphome.cpp_generator import new_Pvariable, static_const_array
|
||||
from esphome.cpp_types import nullptr
|
||||
|
@ -9,7 +9,6 @@ from ..defines import (
|
|||
CONF_BUTTONS,
|
||||
CONF_CLOSE_BUTTON,
|
||||
CONF_MSGBOXES,
|
||||
CONF_TEXT,
|
||||
CONF_TITLE,
|
||||
TYPE_FLEX,
|
||||
literal,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import esphome.config_validation as cv
|
||||
from esphome.const import CONF_MAX_LENGTH
|
||||
from esphome.const import CONF_MAX_LENGTH, CONF_TEXT
|
||||
|
||||
from ..defines import (
|
||||
CONF_ACCEPTED_CHARS,
|
||||
|
@ -10,7 +10,6 @@ from ..defines import (
|
|||
CONF_PLACEHOLDER_TEXT,
|
||||
CONF_SCROLLBAR,
|
||||
CONF_SELECTED,
|
||||
CONF_TEXT,
|
||||
CONF_TEXTAREA_PLACEHOLDER,
|
||||
)
|
||||
from ..lv_validation import lv_bool, lv_int, lv_text
|
||||
|
|
|
@ -308,6 +308,7 @@ CONF_FLASH_LENGTH = "flash_length"
|
|||
CONF_FLASH_TRANSITION_LENGTH = "flash_transition_length"
|
||||
CONF_FLOW = "flow"
|
||||
CONF_FLOW_CONTROL_PIN = "flow_control_pin"
|
||||
CONF_FONT = "font"
|
||||
CONF_FOR = "for"
|
||||
CONF_FORCE_UPDATE = "force_update"
|
||||
CONF_FOREGROUND_COLOR = "foreground_color"
|
||||
|
@ -407,6 +408,7 @@ CONF_INVERTED = "inverted"
|
|||
CONF_IP_ADDRESS = "ip_address"
|
||||
CONF_IRQ_PIN = "irq_pin"
|
||||
CONF_IS_RGBW = "is_rgbw"
|
||||
CONF_ITEMS = "items"
|
||||
CONF_JS_INCLUDE = "js_include"
|
||||
CONF_JS_URL = "js_url"
|
||||
CONF_JVC = "jvc"
|
||||
|
@ -841,6 +843,7 @@ CONF_TEMPERATURE = "temperature"
|
|||
CONF_TEMPERATURE_OFFSET = "temperature_offset"
|
||||
CONF_TEMPERATURE_SOURCE = "temperature_source"
|
||||
CONF_TEMPERATURE_STEP = "temperature_step"
|
||||
CONF_TEXT = "text"
|
||||
CONF_TEXT_SENSORS = "text_sensors"
|
||||
CONF_THEN = "then"
|
||||
CONF_THRESHOLD = "threshold"
|
||||
|
|
Loading…
Reference in a new issue