[Python-checkins] cpython: Issue #4832: Modify IDLE to save files with .py extension by

ned.deily python-checkins at python.org
Fri Jul 13 09:45:39 CEST 2012


http://hg.python.org/cpython/rev/677a9326b4d4
changeset:   78076:677a9326b4d4
user:        Ned Deily <nad at acm.org>
date:        Mon Jul 09 18:16:11 2012 -0700
summary:
  Issue #4832: Modify IDLE to save files with .py extension by
default on Windows and OS X as it already does with X11 Tk.

files:
  Lib/idlelib/IOBinding.py |  8 ++++++--
  Lib/idlelib/NEWS.txt     |  3 +++
  2 files changed, 9 insertions(+), 2 deletions(-)


diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
--- a/Lib/idlelib/IOBinding.py
+++ b/Lib/idlelib/IOBinding.py
@@ -485,6 +485,8 @@
         ("All files", "*"),
         ]
 
+    defaultextension = '.py' if sys.platform == 'darwin' else ''
+
     def askopenfile(self):
         dir, base = self.defaultfilename("open")
         if not self.opendialog:
@@ -508,8 +510,10 @@
     def asksavefile(self):
         dir, base = self.defaultfilename("save")
         if not self.savedialog:
-            self.savedialog = tkFileDialog.SaveAs(master=self.text,
-                                                  filetypes=self.filetypes)
+            self.savedialog = tkFileDialog.SaveAs(
+                    master=self.text,
+                    filetypes=self.filetypes,
+                    defaultextension=self.defaultextension)
         filename = self.savedialog.show(initialdir=dir, initialfile=base)
         return filename
 
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -1,6 +1,9 @@
 What's New in IDLE 3.3.0?
 =========================
 
+- Issue #4832: Modify IDLE to save files with .py extension by
+  default on Windows and OS X (Tk 8.5) as it already does with X11 Tk.
+
 - Issue #13532, #15319: Check that arguments to sys.stdout.write are strings.
 
 - Issue # 12510: Attempt to get certain tool tips no longer crashes IDLE.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list