mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-01 02:28:28 +02:00
[lvgl] Final stage (#7184)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
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 . 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)) is not None:
|
||||
lv.checkbox_set_text(w.obj, await lv_text.process(value))
|
||||
|
||||
|
||||
checkbox_spec = CheckboxType()
|
||||
Reference in New Issue
Block a user