mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-13 08:03:32 +02:00
[lvgl] Stage 4 (#7166)
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
from .defines import CONF_INDICATOR, CONF_MAIN, CONF_TEXT
|
||||
from .lv_validation import lv_text
|
||||
from .lvcode import lv
|
||||
from .schemas import TEXT_SCHEMA
|
||||
from .types import LvBoolean
|
||||
from .widget import Widget, WidgetType
|
||||
|
||||
CONF_CHECKBOX = "checkbox"
|
||||
|
||||
|
||||
class CheckboxType(WidgetType):
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
CONF_CHECKBOX,
|
||||
LvBoolean("lv_checkbox_t"),
|
||||
(CONF_MAIN, CONF_INDICATOR),
|
||||
TEXT_SCHEMA,
|
||||
)
|
||||
|
||||
async def to_code(self, w: Widget, config):
|
||||
if value := config.get(CONF_TEXT):
|
||||
lv.checkbox_set_text(w.obj, await lv_text.process(value))
|
||||
|
||||
|
||||
checkbox_spec = CheckboxType()
|
||||
Reference in New Issue
Block a user