Skip to content

Commit a68a3d2

Browse files
Remove max_size parameter from descendants of Group
1 parent 715c4fd commit a68a3d2

File tree

9 files changed

+12
-38
lines changed

9 files changed

+12
-38
lines changed

adafruit_displayio_layout/layouts/grid_layout.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,11 @@ class GridLayout(displayio.Group):
4040
:param int height: Height of the layout in pixels.
4141
:param tuple grid_size: Size in cells as two ints in a tuple e.g. (2, 2)
4242
:param int cell_padding: Extra padding space inside each cell. In pixels.
43-
:param int max_size: (Optional) this will get passed through to the
44-
displayio.Group constructor. If omitted we default to
45-
grid_size width * grid_size height to make room for all (1, 1) sized cells.
46-
4743
"""
4844

4945
# pylint: disable=too-many-arguments
50-
def __init__(self, x, y, width, height, grid_size, cell_padding, max_size=None):
51-
if not max_size:
52-
max_size = grid_size[0] * grid_size[1]
53-
super().__init__(x=x, y=y, max_size=max_size)
46+
def __init__(self, x, y, width, height, grid_size, cell_padding):
47+
super().__init__(x=x, y=y)
5448
self.x = x
5549
self.y = y
5650
self._width = width

adafruit_displayio_layout/widgets/annotation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def __init__(
181181
self._line0 = Line(line_x0, line_y0, line_x1, line_y1, color=line_color)
182182
self._line1 = Line(line_x1, line_y1, line_x2, line_y2, color=line_color)
183183

184-
super().__init__(max_size=3)
184+
super().__init__()
185185
# Group elements:
186186
# 0. Line0 - from (x,y) to (x+delta_x, y+delta_y)
187187
# 1. Line1 - horizontal line for text

adafruit_displayio_layout/widgets/cartesian.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class Cartesian(Widget):
102102
.. code-block:: python
103103
104104
my_plane= Plane(20, 30) # instance the plane at x=20, y=30
105-
my_group = displayio.Group(max_size=10) # make a group that can hold 10 items
105+
my_group = displayio.Group() # make a group
106106
my_group.append(my_plane) # Add my_plane to the group
107107
108108
#
@@ -183,7 +183,7 @@ def __init__(
183183
**kwargs,
184184
) -> None:
185185

186-
super().__init__(**kwargs, max_size=3)
186+
super().__init__(**kwargs)
187187

188188
self._background_color = background_color
189189

adafruit_displayio_layout/widgets/dial.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,8 @@ def __init__(
208208
value_label_anchor_on_widget=(0.5, 0.5), # default label position on widget
209209
**kwargs,
210210
):
211-
212211
# initialize the Widget superclass (x, y, scale)
213-
super().__init__(**kwargs, max_size=3)
214-
# Define how many graphical elements will be in this group
215-
# using "max_size=XX"
216-
#
212+
super().__init__(**kwargs)
217213
# Group elements for SwitchRoundHorizontal:
218214
# 0. TileGrid holding bitmap with ticks and tick label text
219215
# 1. Value label (optional)

adafruit_displayio_layout/widgets/flip_input.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ def __init__(
102102
cool_down=0.0,
103103
**kwargs,
104104
):
105-
106-
super().__init__(**kwargs, max_size=4)
105+
super().__init__(**kwargs)
107106
# Group elements for the FlipInput.
108107
# 0. The text
109108
# 1. The group holding the temporary scroll bitmap
@@ -235,8 +234,7 @@ def __init__(
235234
self._update_position() # call Widget superclass function to reposition
236235

237236
self._animation_group = displayio.Group(
238-
max_size=1,
239-
scale=self._font_scale,
237+
scale=self._font_scale
240238
) # holds the animation bitmap
241239
# self._animation_group.x = -1 * left * (1)
242240
# self._animation_group.y = -1 * top * (1)

adafruit_displayio_layout/widgets/icon_animated.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ class IconAnimated(IconWidget):
6464
:type anchor_point: Tuple[float,float]
6565
:param int anchored_position: (x,y) pixel value for the location of the anchor_point
6666
:type anchored_position: Tuple[int, int]
67-
:param int max_size: (Optional) this will get passed through to the
68-
displayio.Group constructor. ``max_size`` should be set to the maximum number of
69-
graphical elements that will be held within the Group of this widget.
7067
"""
7168

7269
# pylint: disable=bad-super-call, too-many-instance-attributes, too-many-locals
@@ -145,7 +142,7 @@ def __init__(
145142
if self.__class__.display is None:
146143
raise ValueError(
147144
"Must initialize class using\n"
148-
"`IconAnimated.init_class(display, max_scale, max_size, max_color_depth)`\n"
145+
"`IconAnimated.init_class(display, max_scale, max_color_depth)`\n"
149146
"prior to instancing IconAnimated widgets."
150147
)
151148

adafruit_displayio_layout/widgets/icon_widget.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ class IconWidget(Widget, Control):
4949
:type anchor_point: Tuple[float,float]
5050
:param int anchored_position: (x,y) pixel value for the location of the anchor_point
5151
:type anchored_position: Tuple[int, int]
52-
:param int max_size: (Optional) this will get passed through to the
53-
displayio.Group constructor. ``max_size`` should be set to the maximum number of
54-
graphical elements that will be held within the Group of this widget.
55-
5652
"""
5753

5854
def __init__(self, label_text, icon, on_disk=False, **kwargs):

adafruit_displayio_layout/widgets/switch_round.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class SwitchRound(Widget, Control):
152152
.. code-block:: python
153153
154154
my_switch = Switch(20, 30) # instance the switch at x=20, y=30
155-
my_group = displayio.Group(max_size=10) # make a group that can hold 10 items
155+
my_group = displayio.Group() # make a group
156156
my_group.append(my_switch) # Add my_switch to the group
157157
158158
#
@@ -445,10 +445,7 @@ def __init__(
445445
):
446446

447447
# initialize the Widget superclass (x, y, scale)
448-
super().__init__(x=x, y=y, height=height, width=width, **kwargs, max_size=4)
449-
# Define how many graphical elements will be in this group
450-
# using "max_size=XX"
451-
#
448+
super().__init__(x=x, y=y, height=height, width=width, **kwargs)
452449
# Group elements for SwitchRound:
453450
# 0. switch_roundrect: The switch background
454451
# 1. switch_circle: The switch button

adafruit_displayio_layout/widgets/widget.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,10 @@ def __init__(
173173
height=None,
174174
anchor_point=None,
175175
anchored_position=None,
176-
**kwargs,
177176
):
178177

179-
super().__init__(x=x, y=y, scale=scale, **kwargs)
178+
super().__init__(x=x, y=y, scale=scale)
180179
# send x,y and scale to Group
181-
# **kwargs should include `max_size`from the subclass implementation
182-
# to define how many graphical elements will be held in the Group that
183-
# makes up this widget
184180
#
185181
# If scale is set > 1, will need to update the Control `touch_boundary`
186182
# to accommodate the larger scale

0 commit comments

Comments
 (0)