mirror of
https://github.com/esphome/esphome.git
synced 2024-12-12 08:24:55 +01:00
Black, flake8, and clang-format fixes
This commit is contained in:
parent
7e4cda852b
commit
7238faa184
2 changed files with 9 additions and 9 deletions
|
@ -8,8 +8,9 @@ namespace esphome {
|
|||
namespace graphical_layout {
|
||||
|
||||
static const char *const TAG = "textpanel";
|
||||
static const int TEXT_ALIGN_X_MASK = (int)display::TextAlign::RIGHT | (int)display::TextAlign::CENTER_HORIZONTAL;
|
||||
static const int TEXT_ALIGN_Y_MASK = (int)display::TextAlign::BOTTOM | (int)display::TextAlign::BASELINE | (int)display::TextAlign::CENTER_VERTICAL;
|
||||
static const int TEXT_ALIGN_X_MASK = (int) display::TextAlign::RIGHT | (int) display::TextAlign::CENTER_HORIZONTAL;
|
||||
static const int TEXT_ALIGN_Y_MASK =
|
||||
(int) display::TextAlign::BOTTOM | (int) display::TextAlign::BASELINE | (int) display::TextAlign::CENTER_VERTICAL;
|
||||
|
||||
void TextPanel::dump_config(int indent_depth, int additional_level_depth) {
|
||||
ESP_LOGCONFIG(TAG, "%*sText: %s", indent_depth, "", this->text_.c_str());
|
||||
|
@ -20,8 +21,7 @@ display::Rect TextPanel::measure_item_internal(display::Display *display) {
|
|||
int y1;
|
||||
int width;
|
||||
int height;
|
||||
display->get_text_bounds(0, 0, this->text_.c_str(), this->font_, this->text_align_, &x1, &y1, &width,
|
||||
&height);
|
||||
display->get_text_bounds(0, 0, this->text_.c_str(), this->font_, this->text_align_, &x1, &y1, &width, &height);
|
||||
return display::Rect(0, 0, width, height);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,6 @@ void TextPanel::render_internal(display::Display *display, display::Rect bounds)
|
|||
|
||||
auto rendered_alignment = display::TextAlign::TOP_LEFT;
|
||||
display->print(bounds.x, bounds.y, this->font_, this->foreground_color_, rendered_alignment, this->text_.c_str());
|
||||
|
||||
}
|
||||
|
||||
} // namespace graphical_layout
|
||||
|
|
|
@ -31,6 +31,7 @@ TEXT_ALIGN = {
|
|||
"BOTTOM_RIGHT": TextAlign.BOTTOM_RIGHT,
|
||||
}
|
||||
|
||||
|
||||
def get_config_schema(base_item_schema, item_type_schema):
|
||||
return base_item_schema.extend(
|
||||
{
|
||||
|
@ -40,7 +41,7 @@ def get_config_schema(base_item_schema, item_type_schema):
|
|||
cv.Optional(CONF_FOREGROUND_COLOR): cv.use_id(color.ColorStruct),
|
||||
cv.Optional(CONF_BACKGROUND_COLOR): cv.use_id(color.ColorStruct),
|
||||
cv.Required(CONF_TEXT): cv.templatable(cv.string),
|
||||
cv.Optional(CONF_TEXT_ALIGN): cv.enum(TEXT_ALIGN, upper=True)
|
||||
cv.Optional(CONF_TEXT_ALIGN): cv.enum(TEXT_ALIGN, upper=True),
|
||||
}
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue