[Python-checkins] r58308 - python/trunk/Lib/idlelib/EditorWindow.py python/trunk/Lib/idlelib/FileList.py python/trunk/Lib/idlelib/NEWS.txt

kurt.kaiser python-checkins at python.org
Thu Oct 4 04:09:17 CEST 2007


Author: kurt.kaiser
Date: Thu Oct  4 04:09:17 2007
New Revision: 58308

Modified:
   python/trunk/Lib/idlelib/EditorWindow.py
   python/trunk/Lib/idlelib/FileList.py
   python/trunk/Lib/idlelib/NEWS.txt
Log:
Clean up EditorWindow close.


Modified: python/trunk/Lib/idlelib/EditorWindow.py
==============================================================================
--- python/trunk/Lib/idlelib/EditorWindow.py	(original)
+++ python/trunk/Lib/idlelib/EditorWindow.py	Thu Oct  4 04:09:17 2007
@@ -560,7 +560,8 @@
 
     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
@@ -827,22 +828,21 @@
         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 = {}
@@ -1504,6 +1504,7 @@
         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()
 

Modified: python/trunk/Lib/idlelib/FileList.py
==============================================================================
--- python/trunk/Lib/idlelib/FileList.py	(original)
+++ python/trunk/Lib/idlelib/FileList.py	Thu Oct  4 04:09:17 2007
@@ -50,7 +50,7 @@
                 break
         return "break"
 
-    def close_edit(self, edit):
+    def unregister_maybe_terminate(self, edit):
         try:
             key = self.inversedict[edit]
         except KeyError:

Modified: python/trunk/Lib/idlelib/NEWS.txt
==============================================================================
--- python/trunk/Lib/idlelib/NEWS.txt	(original)
+++ python/trunk/Lib/idlelib/NEWS.txt	Thu Oct  4 04:09:17 2007
@@ -3,6 +3,8 @@
 
 *Release date: XX-XXX-200X*
 
+- Clean up EditorWindow close.
+
 - Corrected some bugs in AutoComplete.  Also, Page Up/Down in ACW implemented;
   mouse and cursor selection in ACWindow implemented; double Tab inserts
   current selection and closes ACW (similar to double-click and Return); scroll
@@ -24,6 +26,8 @@
 - Bug #813342: Start the IDLE subprocess with -Qnew if the parent
   is started with that option.
 
+- Honor the "Cancel" action in the save dialog (Debian bug #299092)
+
 - Some syntax errors were being caught by tokenize during the tabnanny
   check, resulting in obscure error messages.  Do the syntax check
   first.  Bug 1562716, 1562719


More information about the Python-checkins mailing list