Method: rich.layout.Layout.render
Calls: 3, Exceptions: 0, Paths: 1Back
Path 1: 3 calls (1.0)
Console (3)
ConsoleOptions (3)
dict (3)
1def render(self, console: Console, options: ConsoleOptions) -> RenderMap:
2 """Render the sub_layouts.
3
4 Args:
5 console (Console): Console instance.
6 options (ConsoleOptions): Console options.
7
8 Returns:
9 RenderMap: A dict that maps Layout on to a tuple of Region, lines
10 """
11 render_width = options.max_width
12 render_height = options.height or console.height
13 region_map = self._make_region_map(render_width, render_height)
14 layout_regions = [
15 (layout, region)
16 for layout, region in region_map.items()
17 if not layout.children
18 ]
19 render_map: Dict["Layout", "LayoutRender"] = {}
20 render_lines = console.render_lines
21 update_dimensions = options.update_dimensions
22
23 for layout, region in layout_regions:
24 lines = render_lines(
25 layout.renderable, update_dimensions(region.width, region.height)
26 )
27 render_map[layout] = LayoutRender(region, lines)
28 return render_map