Merge pull request #1195 from davep/button-variant-check

Check button variant for validity during button construction
This commit is contained in:
Will McGugan
2022-11-16 16:58:09 +00:00
committed by GitHub
2 changed files with 2 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Watchers are now called immediately when setting the attribute if they are synchronous. https://github.com/Textualize/textual/pull/1145 - Watchers are now called immediately when setting the attribute if they are synchronous. https://github.com/Textualize/textual/pull/1145
- Widget.call_later has been renamed to Widget.call_after_refresh. - Widget.call_later has been renamed to Widget.call_after_refresh.
- Button variant values are now checked at runtime. https://github.com/Textualize/textual/issues/1189
### Fixed ### Fixed

View File

@@ -186,7 +186,7 @@ class Button(Static, can_focus=True):
if disabled: if disabled:
self.add_class("-disabled") self.add_class("-disabled")
self.variant = variant self.variant = self.validate_variant(variant)
label: Reactive[RenderableType] = Reactive("") label: Reactive[RenderableType] = Reactive("")
variant = Reactive.init("default") variant = Reactive.init("default")