From 0ffcd6fb82429269965ae88abcf9ed6f1f802feb Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sun, 20 Oct 2024 17:28:29 +0100 Subject: [PATCH] digit tweaks --- src/textual/demo2/widgets.py | 3 +-- src/textual/renderables/digits.py | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/textual/demo2/widgets.py b/src/textual/demo2/widgets.py index 2d6e29b05e..6a1eded388 100644 --- a/src/textual/demo2/widgets.py +++ b/src/textual/demo2/widgets.py @@ -260,8 +260,7 @@ class WidgetsScreen(PageScreen): def compose(self) -> ComposeResult: with containers.VerticalScroll(): - with containers.Center(classes="column"): - yield Markdown(WIDGETS_MD) + yield Markdown(WIDGETS_MD, classes="column") yield Buttons() yield Checkboxes() yield Datatables() diff --git a/src/textual/renderables/digits.py b/src/textual/renderables/digits.py index dcd18ff959..0285e30f3e 100644 --- a/src/textual/renderables/digits.py +++ b/src/textual/renderables/digits.py @@ -173,6 +173,8 @@ class Digits: """ + REPLACEMENTS = str.maketrans({".": "•"}) + def __init__(self, text: str, style: StyleType = "") -> None: self._text = text self._style = style @@ -202,7 +204,7 @@ def render(self, style: Style) -> RenderResult: else: digits = DIGITS3X3 - for character in self._text: + for character in self._text.translate(self.REPLACEMENTS): try: position = DIGITS.index(character) * 3 except ValueError: