From c4f752f803a20948826eff4601ea595d8b74bb96 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 17 Feb 1999 17:20:50 +0000 Subject: [PATCH] Fix up the Windows menu via the new callback mechanism instead of depending on menu post commands (which don't work when the menu is torn off). --- Tools/idle/EditorWindow.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py index 096f275e093..0aa31ea01c7 100644 --- a/Tools/idle/EditorWindow.py +++ b/Tools/idle/EditorWindow.py @@ -7,6 +7,7 @@ import tkSimpleDialog import tkMessageBox import idlever +import WindowList # File menu @@ -159,7 +160,7 @@ def __init__(self, flist=None, filename=None, key=None, root=None): menu.add_separator() end = end + 1 self.wmenu_end = end - menu.configure(postcommand=self.postwindowsmenu) + WindowList.register_callback(self.postwindowsmenu) def wakeup(self): if self.top.wm_state() == "iconic": @@ -196,7 +197,6 @@ def postwindowsmenu(self): end = -1 if end > self.wmenu_end: menu.delete(self.wmenu_end+1, end) - import WindowList WindowList.add_windows_to_menu(menu) rmenu = None @@ -441,6 +441,7 @@ def close(self): self.top.tkraise() reply = self.maybesave() if reply != "cancel": + WindowList.unregister_callback(self.postwindowsmenu) if self.close_hook: self.close_hook() colorizing = 0 @@ -450,6 +451,7 @@ def close(self): self.color.close(doh) # Cancel colorization if not colorizing: self.top.destroy() + self.top.after_idle(WindowList.call_callbacks) return reply def load_extensions(self):