Skip to content

Commit 8aa880d

Browse files
authored
Merge pull request #40 from lesamouraipourpre/max-size
Remove max_size parameter
2 parents 715c4fd + e6cc249 commit 8aa880d

20 files changed

+23
-51
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

examples/displayio_layout_annotation_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
text="Freeform annotation (display.width, height)",
6060
)
6161

62-
my_group = displayio.Group(max_size=4)
62+
my_group = displayio.Group()
6363
my_group.append(my_switch)
6464
my_group.append(switch_annotation)
6565
my_group.append(switch_annotation_under)

examples/displayio_layout_cartesian_advanced_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222

2323
# Create different Cartesian widgets
24-
my_group = displayio.Group(max_size=10)
24+
my_group = displayio.Group()
2525

2626
car = Cartesian(
2727
x=25,

examples/displayio_layout_cartesian_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
font_color=0xFFFFFF, # ticks line color
3636
)
3737

38-
my_group = displayio.Group(max_size=3)
38+
my_group = displayio.Group()
3939
my_group.append(my_plane)
4040
display.show(my_group) # add high level Group to the display
4141

examples/displayio_layout_dial_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
tick_label_scale=2.0, # the scale factor for the tick label font
4040
)
4141

42-
my_group = displayio.Group(max_size=1)
42+
my_group = displayio.Group()
4343
my_group.append(my_dial)
4444

4545
display.show(my_group) # add high level Group to the display

examples/displayio_layout_flip_input_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
my_flip3.value = "2015" # or set the value based on a string that is in the value_list
9393

9494
# Create the group to display and append the FlipInput widgets
95-
my_group = displayio.Group(max_size=3)
95+
my_group = displayio.Group()
9696
my_group.append(my_flip1)
9797
my_group.append(my_flip2)
9898
my_group.append(my_flip3)

examples/displayio_layout_gridlayout_pygame_display_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from adafruit_displayio_layout.layouts.grid_layout import GridLayout
1616

1717
display = PyGameDisplay(width=320, height=240)
18-
main_group = displayio.Group(max_size=10)
18+
main_group = displayio.Group()
1919
display.show(main_group)
2020

2121
layout = GridLayout(

examples/displayio_layout_gridlayout_simpletest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
display = board.DISPLAY
1818

1919
# Make the display context
20-
main_group = displayio.Group(max_size=10)
20+
main_group = displayio.Group()
2121
display.show(main_group)
2222

2323
layout = GridLayout(
@@ -27,7 +27,6 @@
2727
height=100,
2828
grid_size=(2, 2),
2929
cell_padding=8,
30-
max_size=10,
3130
)
3231
_labels = []
3332

examples/displayio_layout_icon_animated_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949
icons = [icon_zoom, icon_shrink]
5050

51-
main_group = displayio.Group(max_size=2)
51+
main_group = displayio.Group()
5252
main_group.append(icon_zoom)
5353
main_group.append(icon_shrink)
5454

examples/displayio_layout_simpletest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
display = board.DISPLAY
2020

2121
# Make the display context
22-
main_group = displayio.Group(max_size=10)
22+
main_group = displayio.Group()
2323
display.show(main_group)
2424

2525
layout = GridLayout(
@@ -29,7 +29,6 @@
2929
height=100,
3030
grid_size=(2, 2),
3131
cell_padding=8,
32-
max_size=10,
3332
)
3433
_labels = []
3534

examples/displayio_layout_switch_multiple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
# the switch anchored_position is 10 pixels from the display
9292
# lower right corner
9393

94-
my_group = displayio.Group(max_size=8)
94+
my_group = displayio.Group()
9595
my_group.append(my_switch)
9696
my_group.append(my_switch2)
9797
my_group.append(my_switch3)

examples/displayio_layout_switch_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
my_switch = Switch(20, 30)
2727

2828

29-
my_group = displayio.Group(max_size=1)
29+
my_group = displayio.Group()
3030
my_group.append(my_switch)
3131

3232
# Add my_group to the display

0 commit comments

Comments
 (0)