From 8516ddaf2b8f6572e61cabc0bc28845babe38853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Wed, 31 May 2023 18:04:53 +0100 Subject: [PATCH 1/2] Delete Reactive.var. Related issues: #2706. --- CHANGELOG.md | 2 +- src/textual/reactive.py | 17 ----------------- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 36dd080f42..e7167d1999 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - `Placeholder.reset_color_cycle` - Removed `Widget.reset_focus` (now called `Widget.blur`) https://github.com/Textualize/textual/issues/2642 - +- Removed `reactive.py::Reactive.var` in favor of `reactive.py::var` https://github.com/Textualize/textual/pull/2709/ ## [0.26.0] - 2023-05-20 diff --git a/src/textual/reactive.py b/src/textual/reactive.py index 998d4079ba..d7ff0ab187 100644 --- a/src/textual/reactive.py +++ b/src/textual/reactive.py @@ -72,23 +72,6 @@ def __rich_repr__(self) -> rich.repr.Result: yield "always_update", self._always_update yield "compute", self._run_compute - @classmethod - def var( - cls, - default: ReactiveType | Callable[[], ReactiveType], - always_update: bool = False, - ) -> Reactive: - """A reactive variable that doesn't update or layout. - - Args: - default: A default value or callable that returns a default. - always_update: Call watchers even when the new value equals the old value. - - Returns: - A Reactive descriptor. - """ - return cls(default, layout=False, repaint=False, init=False) - def _initialize_reactive(self, obj: Reactable, name: str) -> None: """Initialized a reactive attribute on an object. From 0c26f62b82b422a53625f3625536a29afa1fb687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Gir=C3=A3o=20Serr=C3=A3o?= <5621605+rodrigogiraoserrao@users.noreply.github.com> Date: Tue, 6 Jun 2023 10:05:25 +0100 Subject: [PATCH 2/2] Mark as breaking change. --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7167d1999..c74ee82874 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,12 +45,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Keybinding right in `Input` is also used to accept a suggestion if the cursor is at the end of the input https://github.com/Textualize/textual/pull/2604 - `Input.__init__` now accepts a `suggester` attribute for completion suggestions https://github.com/Textualize/textual/pull/2604 - Using `switch_screen` to switch to the currently active screen is now a no-op https://github.com/Textualize/textual/pull/2692 +- Breaking change: removed `reactive.py::Reactive.var` in favor of `reactive.py::var` https://github.com/Textualize/textual/pull/2709/ ### Removed - `Placeholder.reset_color_cycle` - Removed `Widget.reset_focus` (now called `Widget.blur`) https://github.com/Textualize/textual/issues/2642 -- Removed `reactive.py::Reactive.var` in favor of `reactive.py::var` https://github.com/Textualize/textual/pull/2709/ ## [0.26.0] - 2023-05-20