summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/IOBinding.py
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2012-07-10 01:16:11 (GMT)
committerNed Deily <nad@acm.org>2012-07-10 01:16:11 (GMT)
commitc65ef9bf556bc5be2517e2275c98504fcc4678ea (patch)
tree2a02c3b1c8cd68fbcdc08264981ea0b959014429 /Lib/idlelib/IOBinding.py
parent78da3bc0af5cc7a89aaa8d30da0a2b3cb4c62887 (diff)
downloadcpython-c65ef9bf556bc5be2517e2275c98504fcc4678ea.zip
cpython-c65ef9bf556bc5be2517e2275c98504fcc4678ea.tar.gz
cpython-c65ef9bf556bc5be2517e2275c98504fcc4678ea.tar.bz2
Issue #4832: Modify IDLE to save files with .py extension by
default on Windows and OS X as it already does with X11 Tk.
Diffstat (limited to 'Lib/idlelib/IOBinding.py')
-rw-r--r--Lib/idlelib/IOBinding.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py
index 9528c9a..ec50eb2 100644
--- a/Lib/idlelib/IOBinding.py
+++ b/Lib/idlelib/IOBinding.py
@@ -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