mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
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).
This commit is contained in:
parent
5437ddfa36
commit
c4f752f803
1 changed files with 4 additions and 2 deletions
|
@ -7,6 +7,7 @@ from Tkinter import *
|
||||||
import tkSimpleDialog
|
import tkSimpleDialog
|
||||||
import tkMessageBox
|
import tkMessageBox
|
||||||
import idlever
|
import idlever
|
||||||
|
import WindowList
|
||||||
|
|
||||||
# File menu
|
# File menu
|
||||||
|
|
||||||
|
@ -159,7 +160,7 @@ class EditorWindow:
|
||||||
menu.add_separator()
|
menu.add_separator()
|
||||||
end = end + 1
|
end = end + 1
|
||||||
self.wmenu_end = end
|
self.wmenu_end = end
|
||||||
menu.configure(postcommand=self.postwindowsmenu)
|
WindowList.register_callback(self.postwindowsmenu)
|
||||||
|
|
||||||
def wakeup(self):
|
def wakeup(self):
|
||||||
if self.top.wm_state() == "iconic":
|
if self.top.wm_state() == "iconic":
|
||||||
|
@ -196,7 +197,6 @@ class EditorWindow:
|
||||||
end = -1
|
end = -1
|
||||||
if end > self.wmenu_end:
|
if end > self.wmenu_end:
|
||||||
menu.delete(self.wmenu_end+1, end)
|
menu.delete(self.wmenu_end+1, end)
|
||||||
import WindowList
|
|
||||||
WindowList.add_windows_to_menu(menu)
|
WindowList.add_windows_to_menu(menu)
|
||||||
|
|
||||||
rmenu = None
|
rmenu = None
|
||||||
|
@ -441,6 +441,7 @@ class EditorWindow:
|
||||||
self.top.tkraise()
|
self.top.tkraise()
|
||||||
reply = self.maybesave()
|
reply = self.maybesave()
|
||||||
if reply != "cancel":
|
if reply != "cancel":
|
||||||
|
WindowList.unregister_callback(self.postwindowsmenu)
|
||||||
if self.close_hook:
|
if self.close_hook:
|
||||||
self.close_hook()
|
self.close_hook()
|
||||||
colorizing = 0
|
colorizing = 0
|
||||||
|
@ -450,6 +451,7 @@ class EditorWindow:
|
||||||
self.color.close(doh) # Cancel colorization
|
self.color.close(doh) # Cancel colorization
|
||||||
if not colorizing:
|
if not colorizing:
|
||||||
self.top.destroy()
|
self.top.destroy()
|
||||||
|
self.top.after_idle(WindowList.call_callbacks)
|
||||||
return reply
|
return reply
|
||||||
|
|
||||||
def load_extensions(self):
|
def load_extensions(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue