An internal renderable used as a Layout placeholder.
| 49 | |
| 50 | |
| 51 | class _Placeholder: |
| 52 | """An internal renderable used as a Layout placeholder.""" |
| 53 | |
| 54 | highlighter = ReprHighlighter() |
| 55 | |
| 56 | def __init__(self, layout: "Layout", style: StyleType = "") -> None: |
| 57 | self.layout = layout |
| 58 | self.style = style |
| 59 | |
| 60 | def __rich_console__( |
| 61 | self, console: Console, options: ConsoleOptions |
| 62 | ) -> RenderResult: |
| 63 | width = options.max_width |
| 64 | height = options.height or options.size.height |
| 65 | layout = self.layout |
| 66 | title = ( |
| 67 | f"{layout.name!r} ({width} x {height})" |
| 68 | if layout.name |
| 69 | else f"({width} x {height})" |
| 70 | ) |
| 71 | yield Panel( |
| 72 | Align.center(Pretty(layout), vertical="middle"), |
| 73 | style=self.style, |
| 74 | title=self.highlighter(title), |
| 75 | border_style="blue", |
| 76 | height=height, |
| 77 | ) |
| 78 | |
| 79 | |
| 80 | class Splitter(ABC): |
no test coverage detected