]> granicus.if.org Git - python/commitdiff
Issue #4832: Modify IDLE to save files with .py extension by
authorNed Deily <nad@acm.org>
Tue, 10 Jul 2012 01:16:11 +0000 (18:16 -0700)
committerNed Deily <nad@acm.org>
Tue, 10 Jul 2012 01:16:11 +0000 (18:16 -0700)
default on Windows and OS X as it already does with X11 Tk.

Lib/idlelib/IOBinding.py
Lib/idlelib/NEWS.txt

index 9528c9acaa048e6235fb09f89a4d02974b01d61d..ec50eb2348fc3e870e27a8d31c2c0d1938a3c0e1 100644 (file)
@@ -485,6 +485,8 @@ class IOBinding:
         ("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 @@ class IOBinding:
     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
 
index e2f31c35fec1e01ffffd57eaf69bfd55d17000a9..0cdf7a6717952f8254172d4ae41ef611774bdaf4 100644 (file)
@@ -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.