From dad930d390d653ad79e4641da2d75f69c551b1b9 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 12 Jan 2023 09:27:14 +0000 Subject: [PATCH 1/3] Add a missing return value to a docstring --- src/textual/cli/tools/diagnose.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/textual/cli/tools/diagnose.py b/src/textual/cli/tools/diagnose.py index 447d21f95..5a73f4307 100644 --- a/src/textual/cli/tools/diagnose.py +++ b/src/textual/cli/tools/diagnose.py @@ -55,7 +55,11 @@ def _os() -> None: def _guess_term() -> str: - """Try and guess which terminal is being used.""" + """Try and guess which terminal is being used. + + Returns: + str: The best guess at the name of the terminal. + """ # First obvious place to look is in $TERM_PROGRAM. term_program = os.environ.get("TERM_PROGRAM") From 2c4a889d7193b806f59e6a3c2ab5f11d2ab93701 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Thu, 12 Jan 2023 09:33:46 +0000 Subject: [PATCH 2/3] Tidy up the output of the console dimensions --- src/textual/cli/tools/diagnose.py | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/textual/cli/tools/diagnose.py b/src/textual/cli/tools/diagnose.py index 5a73f4307..4b6803a05 100644 --- a/src/textual/cli/tools/diagnose.py +++ b/src/textual/cli/tools/diagnose.py @@ -3,8 +3,10 @@ import os import sys import platform +from typing import Any +from functools import singledispatch from importlib_metadata import version -from rich.console import Console +from rich.console import Console, ConsoleDimensions def _section(title: str, values: dict[str, str]) -> None: @@ -115,11 +117,29 @@ def _term() -> None: ) +@singledispatch +def _str_rich(value: Any) -> str: + """Convert a rich console option to a string. + + Args: + value (Any): The value to convert to a string. + + Returns: + str: The string version of the value for output + """ + return str(value) + + +@_str_rich.register +def _(value: ConsoleDimensions) -> str: + return f"width={value.width}, height={value.height}" + + def _console() -> None: """Print The Rich console options.""" _section( "Rich Console options", - {k: str(v) for k, v in Console().options.__dict__.items()}, + {k: _str_rich(v) for k, v in Console().options.__dict__.items()}, ) From 922c2273b1d0849d12cbabc552292bca2a95c45a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Thu, 12 Jan 2023 12:00:53 +0000 Subject: [PATCH 3/3] Match clock color to header. --- CHANGELOG.md | 1 + src/textual/widgets/_header.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af9c30012..402b8064c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fail-fast and print pretty tracebacks for Widget compose errors https://github.com/Textualize/textual/pull/1505 - Added Widget._refresh_scroll to avoid expensive layout when scrolling https://github.com/Textualize/textual/pull/1524 - `events.Paste` now bubbles https://github.com/Textualize/textual/issues/1434 +- Clock color in the `Header` widget now matches the header color https://github.com/Textualize/textual/issues/1459 ### Fixed diff --git a/src/textual/widgets/_header.py b/src/textual/widgets/_header.py index 66e4d4fe0..197601481 100644 --- a/src/textual/widgets/_header.py +++ b/src/textual/widgets/_header.py @@ -45,7 +45,7 @@ class HeaderClock(HeaderClockSpace): DEFAULT_CSS = """ HeaderClock { - background: $secondary-background-lighten-1; + background: $foreground-darken-1 5%; color: $text; text-opacity: 85%; content-align: center middle; @@ -97,7 +97,7 @@ class Header(Widget): } Header.-tall { height: 3; - } + } """ tall = Reactive(False)