Adds a name attribute to Spinner

Makes it nicer for validation and use of the `Spinner` object
in later functions/classes.
This commit is contained in:
Kai Giokas 2024-05-14 09:32:40 -04:00
parent 349042fd89
commit 959c937e94
No known key found for this signature in database
3 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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)

View File

@ -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