From a5b31703a3f5e27f823cb113da1701ab74f04f55 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Wed, 11 Sep 2024 16:54:44 +0100 Subject: [PATCH 1/2] changelog --- CHANGELOG.md | 1 + src/textual/app.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7d990ca1e..7da5a55186 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed `RichLog.write` not respecting `width` parameter https://github.com/Textualize/textual/pull/4978 - Fixed `RichLog` writing at wrong width when `write` occurs before width is known (e.g. in `compose` or `on_mount`) https://github.com/Textualize/textual/pull/4978 - Fixed `RichLog.write` incorrectly shrinking width to `RichLog.min_width` when `shrink=True` (now shrinks to fit content area instead) https://github.com/Textualize/textual/pull/4978 +- Fixed flicker when setting `dark` reactive on startup ## [0.79.1] - 2024-08-31 diff --git a/src/textual/app.py b/src/textual/app.py index b0488ded72..cf460fd4a7 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -1084,17 +1084,17 @@ def watch_dark(self, dark: bool) -> None: self.set_class(dark, "-dark-mode", update=False) self.set_class(not dark, "-light-mode", update=False) self._refresh_truecolor_filter(self.ansi_theme) - self.call_later(self.refresh_css) + self.call_next(self.refresh_css) def watch_ansi_theme_dark(self, theme: TerminalTheme) -> None: if self.dark: self._refresh_truecolor_filter(theme) - self.call_later(self.refresh_css) + self.call_next(self.refresh_css) def watch_ansi_theme_light(self, theme: TerminalTheme) -> None: if not self.dark: self._refresh_truecolor_filter(theme) - self.call_later(self.refresh_css) + self.call_next(self.refresh_css) @property def ansi_theme(self) -> TerminalTheme: @@ -3130,7 +3130,10 @@ def refresh_css(self, animate: bool = True) -> None: stylesheet.set_variables(self.get_css_variables()) stylesheet.reparse() stylesheet.update(self.app, animate=animate) - self.screen._refresh_layout(self.size) + try: + self.screen._refresh_layout(self.size) + except ScreenError: + pass # The other screens in the stack will need to know about some style # changes, as a final pass let's check in on every screen that isn't # the current one and update them too. From e39d6776282cbe942e68c44ef93b87c247308d41 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Wed, 11 Sep 2024 16:55:34 +0100 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7da5a55186..02bb52ad7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed `RichLog.write` not respecting `width` parameter https://github.com/Textualize/textual/pull/4978 - Fixed `RichLog` writing at wrong width when `write` occurs before width is known (e.g. in `compose` or `on_mount`) https://github.com/Textualize/textual/pull/4978 - Fixed `RichLog.write` incorrectly shrinking width to `RichLog.min_width` when `shrink=True` (now shrinks to fit content area instead) https://github.com/Textualize/textual/pull/4978 -- Fixed flicker when setting `dark` reactive on startup +- Fixed flicker when setting `dark` reactive on startup https://github.com/Textualize/textual/pull/4989 ## [0.79.1] - 2024-08-31