From 93432b85b96766f89f360face439d052b937e218 Mon Sep 17 00:00:00 2001 From: Michael Davidson Date: Tue, 26 Dec 2023 13:07:37 +1100 Subject: [PATCH] Black. flake8, pylint, and clang-format fixes --- .../components/graphical_layout/display_rendering_panel.cpp | 4 +++- .../components/graphical_layout/display_rendering_panel.py | 2 +- esphome/components/graphical_layout/horizontal_stack.cpp | 2 +- esphome/components/graphical_layout/horizontal_stack.py | 2 +- esphome/components/graphical_layout/layout_item.cpp | 2 +- esphome/components/graphical_layout/layout_item.h | 4 ++-- esphome/components/graphical_layout/text_panel.py | 1 - esphome/components/graphical_layout/vertical_stack.cpp | 2 +- esphome/components/graphical_layout/vertical_stack.py | 3 ++- 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/esphome/components/graphical_layout/display_rendering_panel.cpp b/esphome/components/graphical_layout/display_rendering_panel.cpp index 904a89aa93..cf3f76b20d 100644 --- a/esphome/components/graphical_layout/display_rendering_panel.cpp +++ b/esphome/components/graphical_layout/display_rendering_panel.cpp @@ -18,7 +18,9 @@ display::Rect DisplayRenderingPanel::measure_item_internal(display::Display *dis return display::Rect(0, 0, this->width_, this->height_); } -void DisplayRenderingPanel::render_internal(display::Display *display, display::Rect bounds) { this->lambda_(*display); } +void DisplayRenderingPanel::render_internal(display::Display *display, display::Rect bounds) { + this->lambda_(*display); +} } // namespace graphical_layout } // namespace esphome diff --git a/esphome/components/graphical_layout/display_rendering_panel.py b/esphome/components/graphical_layout/display_rendering_panel.py index c43effaee2..422c6c4feb 100644 --- a/esphome/components/graphical_layout/display_rendering_panel.py +++ b/esphome/components/graphical_layout/display_rendering_panel.py @@ -1,6 +1,6 @@ import esphome.codegen as cg import esphome.config_validation as cv -from esphome.const import CONF_ID, CONF_WIDTH, CONF_HEIGHT, CONF_LAMBDA +from esphome.const import CONF_WIDTH, CONF_HEIGHT, CONF_LAMBDA from esphome.components.display import DisplayRef graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") diff --git a/esphome/components/graphical_layout/horizontal_stack.cpp b/esphome/components/graphical_layout/horizontal_stack.cpp index 5557b7af81..ef528e7bfc 100644 --- a/esphome/components/graphical_layout/horizontal_stack.cpp +++ b/esphome/components/graphical_layout/horizontal_stack.cpp @@ -11,7 +11,7 @@ static const char *const TAG = "horizontalstack"; void HorizontalStack::dump_config(int indent_depth, int additional_level_depth) { ESP_LOGCONFIG(TAG, "%*sItem Padding: %i", indent_depth, "", this->item_padding_); - ESP_LOGCONFIG(TAG, "%*sChild alignment: %i", indent_depth, "", (int)this->child_align_); + ESP_LOGCONFIG(TAG, "%*sChild alignment: %i", indent_depth, "", (int) this->child_align_); ESP_LOGCONFIG(TAG, "%*sChildren: %i", indent_depth, "", this->children_.size()); for (LayoutItem *child : this->children_) { diff --git a/esphome/components/graphical_layout/horizontal_stack.py b/esphome/components/graphical_layout/horizontal_stack.py index 39058b211d..0865795eb3 100644 --- a/esphome/components/graphical_layout/horizontal_stack.py +++ b/esphome/components/graphical_layout/horizontal_stack.py @@ -1,6 +1,6 @@ import esphome.codegen as cg import esphome.config_validation as cv -from esphome.const import CONF_ID, CONF_TYPE +from esphome.const import CONF_TYPE graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") HorizontalStack = graphical_layout_ns.class_("HorizontalStack") diff --git a/esphome/components/graphical_layout/layout_item.cpp b/esphome/components/graphical_layout/layout_item.cpp index 77fe139b71..a43205e2ae 100644 --- a/esphome/components/graphical_layout/layout_item.cpp +++ b/esphome/components/graphical_layout/layout_item.cpp @@ -39,7 +39,7 @@ void LayoutItem::render(display::Display *display, display::Rect bounds) { } // Padding - display->set_local_coordinates_relative_to_current(this->border_ + this->padding_, this->border_ + this->padding_); + display->set_local_coordinates_relative_to_current(this->border_ + this->padding_, this->border_ + this->padding_); int margin_border_padding_offset = (this->margin_ + this->border_ + this->padding_) * 2; display::Rect internal_bounds(0, 0, bounds.w - margin_border_padding_offset, bounds.h - margin_border_padding_offset); diff --git a/esphome/components/graphical_layout/layout_item.h b/esphome/components/graphical_layout/layout_item.h index c16f5f0131..ab1636f0ec 100644 --- a/esphome/components/graphical_layout/layout_item.h +++ b/esphome/components/graphical_layout/layout_item.h @@ -53,7 +53,7 @@ class LayoutItem { /** Measures the internal size of the item this should only be the portion drawn exclusive * of any padding or margins - * + * * param[in] display: Display that will be used for rendering. May be used to help with calculations */ virtual display::Rect measure_item_internal(display::Display *display) = 0; @@ -69,7 +69,7 @@ class LayoutItem { /** Performs the rendering of the item internals of the item exclusive of any padding or margins * (or rather, after they've already been handled by render) - * + * * param[in] display: Display to render to * param[in] bounds: Size of the area drawing should be constrained to */ diff --git a/esphome/components/graphical_layout/text_panel.py b/esphome/components/graphical_layout/text_panel.py index 9d6e272523..5a22f9d346 100644 --- a/esphome/components/graphical_layout/text_panel.py +++ b/esphome/components/graphical_layout/text_panel.py @@ -1,7 +1,6 @@ import esphome.codegen as cg import esphome.config_validation as cv from esphome.components import font, color -from esphome.const import CONF_ID graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") TextPanel = graphical_layout_ns.class_("TextPanel") diff --git a/esphome/components/graphical_layout/vertical_stack.cpp b/esphome/components/graphical_layout/vertical_stack.cpp index ec6acc0896..c287784665 100644 --- a/esphome/components/graphical_layout/vertical_stack.cpp +++ b/esphome/components/graphical_layout/vertical_stack.cpp @@ -11,7 +11,7 @@ static const char *const TAG = "verticalstack"; void VerticalStack::dump_config(int indent_depth, int additional_level_depth) { ESP_LOGCONFIG(TAG, "%*sItem Padding: %i", indent_depth, "", this->item_padding_); - ESP_LOGCONFIG(TAG, "%*sChild alignment: %i", indent_depth, "", (int)this->child_align_); + ESP_LOGCONFIG(TAG, "%*sChild alignment: %i", indent_depth, "", (int) this->child_align_); ESP_LOGCONFIG(TAG, "%*sChildren: %i", indent_depth, "", this->children_.size()); for (LayoutItem *child : this->children_) { diff --git a/esphome/components/graphical_layout/vertical_stack.py b/esphome/components/graphical_layout/vertical_stack.py index c9fde899be..8ad6929621 100644 --- a/esphome/components/graphical_layout/vertical_stack.py +++ b/esphome/components/graphical_layout/vertical_stack.py @@ -1,6 +1,6 @@ import esphome.codegen as cg import esphome.config_validation as cv -from esphome.const import CONF_ID, CONF_TYPE +from esphome.const import CONF_TYPE graphical_layout_ns = cg.esphome_ns.namespace("graphical_layout") VerticalStack = graphical_layout_ns.class_("VerticalStack") @@ -18,6 +18,7 @@ HORIZONTAL_CHILD_ALIGN = { "STRETCH_TO_FIT_WIDTH": HorizontalChildAlign.STRETCH_TO_FIT_WIDTH, } + def get_config_schema(base_item_schema, item_type_schema): return base_item_schema.extend( {