diff options
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r-- | Lib/idlelib/EditorWindow.py | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py index a0a7b47..0cd668a 100644 --- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -386,7 +386,7 @@ class EditorWindow(object): def help_dialog(self, event=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),'help.txt') - textView.TextViewer(self.top,'Help',fn) + textView.view_file(self.top,'Help',fn) def python_docs(self, event=None): if sys.platform[:3] == 'win': @@ -408,6 +408,7 @@ class EditorWindow(object): def paste(self,event): self.text.event_generate("<<Paste>>") + self.text.see("insert") return "break" def select_all(self, event=None): @@ -549,7 +550,8 @@ class EditorWindow(object): def close_hook(self): if self.flist: - self.flist.close_edit(self) + self.flist.unregister_maybe_terminate(self) + self.flist = None def set_close_hook(self, close_hook): self.close_hook = close_hook @@ -828,22 +830,21 @@ class EditorWindow(object): if self.io.filename: self.update_recent_files_list(new_file=self.io.filename) WindowList.unregister_callback(self.postwindowsmenu) - if self.close_hook: - self.close_hook() - self.flist = None - colorizing = 0 self.unload_extensions() - self.io.close(); self.io = None - self.undo = None # XXX + self.io.close() + self.io = None + self.undo = None if self.color: - colorizing = self.color.colorizing - doh = colorizing and self.top - self.color.close(doh) # Cancel colorization + self.color.close(False) + self.color = None self.text = None self.tkinter_vars = None - self.per.close(); self.per = None - if not colorizing: - self.top.destroy() + self.per.close() + self.per = None + self.top.destroy() + if self.close_hook: + # unless override: unregister from flist, terminate if last window + self.close_hook() def load_extensions(self): self.extensions = {} @@ -1501,6 +1502,7 @@ def test(): filename = None edit = EditorWindow(root=root, filename=filename) edit.set_close_hook(root.quit) + edit.text.bind("<<close-all-windows>>", edit.close_event) root.mainloop() root.destroy() |