Skip to content

Update grid_layout.py #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions adafruit_displayio_layout/layouts/grid_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ class GridLayout(displayio.Group):
lines above. Row indexes are 0 based.
:param Union[tuple, list] v_divider_line_cols: Column indexes to draw divider
lines before. Column indexes are 0 based.
:param divider_line_color: The color of the divider lines (in hexadecimal)

"""

# pylint: disable=too-many-arguments
# pylint: disable=too-many-instance-attributes
def __init__(
self,
x,
Expand All @@ -59,6 +61,7 @@ def __init__(
divider_lines=False,
h_divider_line_rows=None,
v_divider_line_cols=None,
divider_line_color=0xFFFFFF,
):
super().__init__(x=x, y=y)
self.x = x
Expand All @@ -70,6 +73,7 @@ def __init__(
self._cell_content_list = []

self._divider_lines = []
self._divider_color = divider_line_color
self.h_divider_line_rows = h_divider_line_rows
self.v_divider_line_cols = v_divider_line_cols

Expand Down Expand Up @@ -164,8 +168,8 @@ def _layout_cells(self):

if self._divider_lines_enabled:
palette = displayio.Palette(2)
palette[0] = 0xFFFFFF
palette[1] = 0xFFFFFF
palette[0] = self._divider_color
palette[1] = self._divider_color

if not hasattr(cell["content"], "anchor_point"):
_bottom_line_loc_y = (
Expand Down