From 12c494983e79f9818dc6b577047f8012524bf819 Mon Sep 17 00:00:00 2001 From: Isaiah Odhner Date: Fri, 5 May 2023 13:37:07 -0400 Subject: [PATCH] Revert "Remove update_styles hack, seemingly not needed anymore" This reverts commit 42ca86f7eb6b31b13259bc353d465a432f6a24fd. It's needed again after the last commit... I did override `focus`, so it's not that surprising. But I definitely want to figure this out. --- src/textual_paint/windows.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/textual_paint/windows.py b/src/textual_paint/windows.py index 9cb2dd3..f6a9010 100644 --- a/src/textual_paint/windows.py +++ b/src/textual_paint/windows.py @@ -140,6 +140,10 @@ class Window(Container): self.mount(self.content) # Set focus. (In the future, some windows will not want default focus...) self.focus() + # Fix for incorrect layout that would only resolve on mouse over + # (I peaked into mouse over handling and it calls update_styles.) + # This can still briefly show the incorrect layout, since it relies on a timer. + self.set_timer(0.01, lambda: self.app.update_styles(self)) def on_focus(self, event: events.Focus) -> None: """Called when the window is focused."""