More clang/ling fixes

This commit is contained in:
Michael Davidson 2023-12-17 21:39:09 +11:00
parent 8cb27b5b78
commit f749d26353
No known key found for this signature in database
GPG key ID: B8D1A99712B8B0EB
7 changed files with 49 additions and 48 deletions

View file

@ -23,6 +23,7 @@ CONF_ITEM_TYPE = "type"
BASE_ITEM_SCHEMA = cv.Schema({})
def item_type_schema(value):
return ITEM_TYPE_SCHEMA(value)
@ -32,7 +33,9 @@ ITEM_TYPE_SCHEMA = cv.typed_schema(
text_panel.CONF_TYPE: BASE_ITEM_SCHEMA.extend(
{
cv.GenerateID(): cv.declare_id(text_panel.TextPanel),
cv.Optional(text_panel.CONF_ITEM_PADDING, default=0): cv.templatable(cv.int_),
cv.Optional(text_panel.CONF_ITEM_PADDING, default=0): cv.templatable(
cv.int_
),
cv.Required(text_panel.CONF_FONT): cv.use_id(font.Font),
cv.Optional(text_panel.CONF_FOREGROUND_COLOR): cv.use_id(
color.ColorStruct
@ -64,7 +67,7 @@ ITEM_TYPE_SCHEMA = cv.typed_schema(
cv.ensure_list(item_type_schema), cv.Length(min=1)
),
}
)
),
}
)

View file

@ -3,7 +3,6 @@
#include "esphome/components/display/display.h"
#include "esphome/core/log.h"
namespace esphome {
namespace graphical_layout {

View file

@ -16,7 +16,7 @@ namespace graphical_layout {
/** Component used for rendering the layout*/
class RootLayoutComponent : public Component {
public:
public:
void setup() override;
void dump_config() override;
@ -30,7 +30,7 @@ class RootLayoutComponent : public Component {
void set_layout_root(LayoutItem *layout) { this->layout_root_ = layout; };
protected:
protected:
LayoutItem *layout_root_{nullptr};
};

View file

@ -10,14 +10,14 @@ namespace graphical_layout {
* The HorizontalStack is a UI element which will render a series of items left-to-right across a display
*/
class HorizontalStack : public ContainerLayoutItem {
public:
public:
const display::Rect measure_item(display::Display *display);
void render(display::Display *display, display::Rect bounds);
void dump_config(int indent_depth, int additional_level_depth);
void set_item_padding(int item_padding) { this->item_padding_ = item_padding; };
protected:
protected:
int item_padding_{0};
};

View file

@ -12,7 +12,7 @@ const Color COLOR_OFF(0, 0, 0, 0);
/** The TextPanel is a UI item that renders a single line of text to a display */
class TextPanel : public LayoutItem {
public:
public:
const display::Rect measure_item(display::Display *display);
void render(display::Display *display, display::Rect bounds);
void dump_config(int indent_depth, int additional_level_depth);
@ -24,7 +24,7 @@ class TextPanel : public LayoutItem {
void set_background_color(Color background_color) { this->background_color_ = background_color; };
protected:
protected:
int item_padding_{0};
std::string text_{};
display::BaseFont *font_{nullptr};

View file

@ -1,5 +1,4 @@
import esphome.codegen as cg
from esphome.components import font, color
from esphome.const import CONF_ID
graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout")

View file

@ -10,14 +10,14 @@ namespace graphical_layout {
/** The HorizontalStack is a UI element which will render a series of items top to bottom down a display
*/
class VerticalStack : public ContainerLayoutItem {
public:
public:
const display::Rect measure_item(display::Display *display);
void render(display::Display *display, display::Rect bounds);
void dump_config(int indent_depth, int additional_level_depth);
void set_item_padding(int item_padding) { this->item_padding_ = item_padding; };
protected:
protected:
int item_padding_{0};
};