From a18685c9c819897b3a41299c188ecf03894d4580 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Wed, 22 Feb 2023 16:28:23 +0000 Subject: [PATCH 1/3] Fix a copy/paste-o in the `TextLog` reference entry --- docs/widgets/text_log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/widgets/text_log.md b/docs/widgets/text_log.md index ccc7ea78c..bb491a28a 100644 --- a/docs/widgets/text_log.md +++ b/docs/widgets/text_log.md @@ -9,7 +9,7 @@ Call [TextLog.write][textual.widgets.TextLog.write] with a string or [Rich Rende ## Example -The example below shows each placeholder variant. +The example below shows an application showing a `TextLog` with different kinds of data logged. === "Output" From 7a0506a3a2aced2fb1ab9d1534498e6f8cfe52a4 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Wed, 22 Feb 2023 16:32:45 +0000 Subject: [PATCH 2/3] Add an __init__ docstring to TextLog A contribution to #1811. --- src/textual/widgets/_text_log.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/textual/widgets/_text_log.py b/src/textual/widgets/_text_log.py index c7efee07a..3f3ced940 100644 --- a/src/textual/widgets/_text_log.py +++ b/src/textual/widgets/_text_log.py @@ -45,6 +45,19 @@ class TextLog(ScrollView, can_focus=True): classes: str | None = None, disabled: bool = False, ) -> None: + """Create a TextLog widget. + + Args: + max_lines: Maximum number of lines in the log or `None` for no maximum. + min_width: Minimum width of renderables. + wrap: Enable word wrapping (default is off). + highlight: Automatically highlight content. + markup: Apply Rich console markup. + name: The name of the button. + id: The ID of the button in the DOM. + classes: The CSS classes of the button. + disabled: Whether the button is disabled or not. + """ super().__init__(name=name, id=id, classes=classes, disabled=disabled) self.max_lines = max_lines self._start_line: int = 0 From d854cb81af66214cf2259fe83f9de1f37f93c036 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Wed, 22 Feb 2023 16:35:31 +0000 Subject: [PATCH 3/3] Add some reactive attribute docstrings to TextLog A contribution to #1811. --- src/textual/widgets/_text_log.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/textual/widgets/_text_log.py b/src/textual/widgets/_text_log.py index 3f3ced940..27e8783f0 100644 --- a/src/textual/widgets/_text_log.py +++ b/src/textual/widgets/_text_log.py @@ -60,15 +60,20 @@ class TextLog(ScrollView, can_focus=True): """ super().__init__(name=name, id=id, classes=classes, disabled=disabled) self.max_lines = max_lines + """Maximum number of lines in the log or `None` for no maximum.""" self._start_line: int = 0 self.lines: list[Strip] = [] self._line_cache: LRUCache[tuple[int, int, int, int], Strip] self._line_cache = LRUCache(1024) self.max_width: int = 0 self.min_width = min_width + """Minimum width of renderables.""" self.wrap = wrap + """Enable word wrapping.""" self.highlight = highlight + """Automatically highlight content.""" self.markup = markup + """Apply Rich console markup.""" self.highlighter = ReprHighlighter() def _on_styles_updated(self) -> None: