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