remove markup, simplify repr (#2623)

* remove markup, simplify repr

* changelog

* remove rendundant repr (thanks Paul)

* changelog
This commit is contained in:
Will McGugan
2023-05-22 20:26:37 +01:00
committed by GitHub
parent 55f887e66e
commit be49aabefe
4 changed files with 4 additions and 11 deletions

View File

@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `Placeholder` now sets its color cycle per app https://github.com/Textualize/textual/issues/2590 - `Placeholder` now sets its color cycle per app https://github.com/Textualize/textual/issues/2590
- Footer now clears key highlight regardless of whether it's in the active screen or not https://github.com/Textualize/textual/issues/2606 - Footer now clears key highlight regardless of whether it's in the active screen or not https://github.com/Textualize/textual/issues/2606
- The default Widget repr no longer displays classes and pseudo-classes (to reduce noise in logs). Add them to your `__rich_repr__` method if needed. https://github.com/Textualize/textual/pull/2623
### Removed ### Removed

View File

@@ -71,7 +71,7 @@ from ._wait import wait_for_idle
from ._worker_manager import WorkerManager from ._worker_manager import WorkerManager
from .actions import ActionParseResult, SkipAction from .actions import ActionParseResult, SkipAction
from .await_remove import AwaitRemove from .await_remove import AwaitRemove
from .binding import Binding, _Bindings, BindingType from .binding import Binding, BindingType, _Bindings
from .css.query import NoMatches from .css.query import NoMatches
from .css.stylesheet import Stylesheet from .css.stylesheet import Stylesheet
from .design import ColorSystem from .design import ColorSystem
@@ -1853,7 +1853,7 @@ class App(Generic[ReturnType], DOMNode):
if self.css_monitor: if self.css_monitor:
self.set_interval(0.25, self.css_monitor, name="css monitor") self.set_interval(0.25, self.css_monitor, name="css monitor")
self.log.system("[b green]STARTED[/]", self.css_monitor) self.log.system("STARTED", self.css_monitor)
async def run_process_messages(): async def run_process_messages():
"""The main message loop, invoke below.""" """The main message loop, invoke below."""
@@ -2713,7 +2713,7 @@ class App(Generic[ReturnType], DOMNode):
def _on_terminal_supports_synchronized_output( def _on_terminal_supports_synchronized_output(
self, message: messages.TerminalSupportsSynchronizedOutput self, message: messages.TerminalSupportsSynchronizedOutput
) -> None: ) -> None:
log.system("[b green]SynchronizedOutput mode is supported") log.system("SynchronizedOutput mode is supported")
self._sync_available = True self._sync_available = True
def _begin_update(self) -> None: def _begin_update(self) -> None:

View File

@@ -35,9 +35,6 @@ if TYPE_CHECKING:
class Event(Message): class Event(Message):
"""The base class for all events.""" """The base class for all events."""
def __rich_repr__(self) -> rich.repr.Result:
yield from ()
@rich.repr.auto @rich.repr.auto
class Callback(Event, bubble=False, verbose=True): class Callback(Event, bubble=False, verbose=True):

View File

@@ -2532,11 +2532,6 @@ class Widget(DOMNode):
yield "id", self.id, None yield "id", self.id, None
if self.name: if self.name:
yield "name", self.name yield "name", self.name
if self.classes:
yield "classes", set(self.classes)
pseudo_classes = self.pseudo_classes
if pseudo_classes:
yield "pseudo_classes", set(pseudo_classes)
def _get_scrollable_region(self, region: Region) -> Region: def _get_scrollable_region(self, region: Region) -> Region:
"""Adjusts the Widget region to accommodate scrollbars. """Adjusts the Widget region to accommodate scrollbars.