Wait for the options window before grabbing it

OptionsDialog called grab_set() straight after transient(), before the window
was on screen. Tk refuses a grab on a window that is not viewable yet, and this
dialog builds enough tabs that it regularly still is not -- the options UI tests
failed with "grab failed: window not viewable" once the mail-template tab grew
another entry.

The grab now waits for an idle callback, which is what the other dialogs in the
codebase already do.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Marcel Peterkau
2026-09-04 22:05:26 +02:00
co-authored by Claude Opus 5
parent e4138e93b6
commit 0252a0c0e3
+4 -1
View File
@@ -86,7 +86,10 @@ class OptionsDialog(tk.Toplevel):
self.mail_template_snippets: dict[str, str] = {}
self.title("Optionen")
self.transient(master.winfo_toplevel())
self.grab_set()
# Tk refuses a grab on a window that is not on screen yet ("window not
# viewable"), and this dialog builds enough tabs to still be unmapped here --
# so the grab waits for the window like it does in the other dialogs.
self.after_idle(self.grab_set)
self.resizable(True, True)
self._build_ui()
self.bind("<Escape>", lambda _event: self.destroy())