mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge branch 'fix-1420' of github.com:Textualize/textual into fix-1420
This commit is contained in:
@@ -23,6 +23,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- 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
|
||||
- Improved error message when style flag `none` is mixed with other flags (e.g., when setting `text-style`) https://github.com/Textualize/textual/issues/1420
|
||||
- Clock color in the `Header` widget now matches the header color https://github.com/Textualize/textual/issues/1459
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@@ -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:
|
||||
@@ -55,7 +57,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")
|
||||
@@ -111,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()},
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user