mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 12:46:22 +01:00
Black, flake8, and clang fixes
This commit is contained in:
parent
00caf53dc4
commit
8d0c8cf965
@ -70,12 +70,18 @@ ITEM_TYPE_SCHEMA = cv.typed_schema(
|
||||
}
|
||||
),
|
||||
display_rendering_panel.CONF_TYPE: BASE_ITEM_SCHEMA.extend(
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(display_rendering_panel.DisplayRenderingPanel),
|
||||
cv.Required(display_rendering_panel.CONF_WIDTH): cv.templatable(cv.int_range(min=1)),
|
||||
cv.Required(display_rendering_panel.CONF_HEIGHT): cv.templatable(cv.int_range(min=1)),
|
||||
cv.Required(display_rendering_panel.CONF_LAMBDA): cv.lambda_,
|
||||
}
|
||||
{
|
||||
cv.GenerateID(): cv.declare_id(
|
||||
display_rendering_panel.DisplayRenderingPanel
|
||||
),
|
||||
cv.Required(display_rendering_panel.CONF_WIDTH): cv.templatable(
|
||||
cv.int_range(min=1)
|
||||
),
|
||||
cv.Required(display_rendering_panel.CONF_HEIGHT): cv.templatable(
|
||||
cv.int_range(min=1)
|
||||
),
|
||||
cv.Required(display_rendering_panel.CONF_LAMBDA): cv.lambda_,
|
||||
}
|
||||
),
|
||||
}
|
||||
)
|
||||
|
@ -18,9 +18,7 @@ const display::Rect DisplayRenderingPanel::measure_item(display::Display *displa
|
||||
return display::Rect(0, 0, this->width_, this->width_);
|
||||
}
|
||||
|
||||
void DisplayRenderingPanel::render(display::Display *display, display::Rect bounds) {
|
||||
this->lambda_(*display);
|
||||
}
|
||||
void DisplayRenderingPanel::render(display::Display *display, display::Rect bounds) { this->lambda_(*display); }
|
||||
|
||||
} // namespace graphical_layout
|
||||
} // namespace esphome
|
||||
|
@ -10,7 +10,7 @@ namespace graphical_layout {
|
||||
using display_writer_t = std::function<void(display::Display &)>;
|
||||
|
||||
/** The DisplayRenderingPanel is a UI item that renders a custom lambda to the display whilst
|
||||
* participating in the layout process
|
||||
* participating in the layout process
|
||||
*/
|
||||
class DisplayRenderingPanel : public LayoutItem {
|
||||
public:
|
||||
|
@ -10,6 +10,7 @@ CONF_HEIGHT = "height"
|
||||
CONF_WIDTH = "width"
|
||||
CONF_LAMBDA = "lambda"
|
||||
|
||||
|
||||
async def config_to_layout_item(item_config, child_item_builder):
|
||||
var = cg.new_Pvariable(item_config[CONF_ID])
|
||||
|
||||
@ -20,7 +21,7 @@ async def config_to_layout_item(item_config, child_item_builder):
|
||||
cg.add(var.set_height(height))
|
||||
|
||||
lambda_ = await cg.process_lambda(
|
||||
item_config[CONF_LAMBDA], [(DisplayRef, "it")], return_type=cg.void
|
||||
item_config[CONF_LAMBDA], [(DisplayRef, "it")], return_type=cg.void
|
||||
)
|
||||
cg.add(var.set_lambda(lambda_))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user