A column containing text.
| 614 | |
| 615 | |
| 616 | class TextColumn(ProgressColumn): |
| 617 | """A column containing text.""" |
| 618 | |
| 619 | def __init__( |
| 620 | self, |
| 621 | text_format: str, |
| 622 | style: StyleType = "none", |
| 623 | justify: JustifyMethod = "left", |
| 624 | markup: bool = True, |
| 625 | highlighter: Optional[Highlighter] = None, |
| 626 | table_column: Optional[Column] = None, |
| 627 | ) -> None: |
| 628 | self.text_format = text_format |
| 629 | self.justify: JustifyMethod = justify |
| 630 | self.style = style |
| 631 | self.markup = markup |
| 632 | self.highlighter = highlighter |
| 633 | super().__init__(table_column=table_column or Column(no_wrap=True)) |
| 634 | |
| 635 | def render(self, task: "Task") -> Text: |
| 636 | _text = self.text_format.format(task=task) |
| 637 | if self.markup: |
| 638 | text = Text.from_markup(_text, style=self.style, justify=self.justify) |
| 639 | else: |
| 640 | text = Text(_text, style=self.style, justify=self.justify) |
| 641 | if self.highlighter: |
| 642 | self.highlighter.highlight(text) |
| 643 | return text |
| 644 | |
| 645 | |
| 646 | class BarColumn(ProgressColumn): |
no outgoing calls