@@ -111,8 +111,13 @@ def __init__(
111
111
):
112
112
self .cell_padding = 1
113
113
114
+ def layout_cells (self ):
115
+ self ._layout_cells ()
116
+
114
117
def _layout_cells (self ) -> None :
115
118
# pylint: disable=too-many-locals, too-many-branches, too-many-statements
119
+ for line_obj in self ._divider_lines :
120
+ self .remove (line_obj ["rect" ])
116
121
for cell in self ._cell_content_list :
117
122
if cell ["content" ] not in self :
118
123
grid_size_x = self .grid_size [0 ]
@@ -359,15 +364,16 @@ def _layout_cells(self) -> None:
359
364
}
360
365
)
361
366
362
- for line_obj in self ._divider_lines :
363
- self .append (line_obj ["rect" ])
367
+ for line_obj in self ._divider_lines :
368
+ self .append (line_obj ["rect" ])
364
369
365
370
def add_content (
366
- self ,
367
- cell_content : displayio .Group ,
368
- grid_position : Tuple [int , int ],
369
- cell_size : Tuple [int , int ],
370
- cell_anchor_point : Optional [Tuple [float , ...]] = None ,
371
+ self ,
372
+ cell_content : displayio .Group ,
373
+ grid_position : Tuple [int , int ],
374
+ cell_size : Tuple [int , int ],
375
+ cell_anchor_point : Optional [Tuple [float , ...]] = None ,
376
+ layout_cells = True
371
377
) -> None :
372
378
"""Add a child to the grid.
373
379
@@ -395,7 +401,8 @@ def add_content(
395
401
"cell_size" : cell_size ,
396
402
}
397
403
self ._cell_content_list .append (sub_view_obj )
398
- self ._layout_cells ()
404
+ if layout_cells :
405
+ self ._layout_cells ()
399
406
400
407
def get_cell (self , cell_coordinates : Tuple [int , int ]) -> displayio .Group :
401
408
"""
0 commit comments