From 959c937e9467074d299b97aa7697653ebb5a6ccc Mon Sep 17 00:00:00 2001 From: Kai Giokas Date: Tue, 14 May 2024 09:32:40 -0400 Subject: [PATCH] Adds a name attribute to Spinner Makes it nicer for validation and use of the `Spinner` object in later functions/classes. --- CHANGELOG.md | 4 ++++ CONTRIBUTORS.md | 1 + rich/spinner.py | 1 + 3 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8735bb47..7d42ee84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Updated the widths of some characters https://github.com/Textualize/rich/pull/3289 +### Added + +- Included a `name` attribute to the `Spinner` class https://github.com/Textualize/rich/pull/3359 + ## [13.7.0] - 2023-11-15 ### Added diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 22b1be0d..5d30e6de 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -18,6 +18,7 @@ The following people have contributed to the development of Rich: - [Aryaz Eghbali](https://github.com/AryazE) - [Oleksis Fraga](https://github.com/oleksis) - [Andy Gimblett](https://github.com/gimbo) +- [Kai Giokas](https://github.com/kaisforza) - [Michał Górny](https://github.com/mgorny) - [Nok Lam Chan](https://github.com/noklam) - [Leron Gray](https://github.com/daddycocoaman) diff --git a/rich/spinner.py b/rich/spinner.py index 91ea630e..70570b6b 100644 --- a/rich/spinner.py +++ b/rich/spinner.py @@ -38,6 +38,7 @@ class Spinner: self.text: "Union[RenderableType, Text]" = ( Text.from_markup(text) if isinstance(text, str) else text ) + self.name = name self.frames = cast(List[str], spinner["frames"])[:] self.interval = cast(float, spinner["interval"]) self.start_time: Optional[float] = None