diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-10-06 04:13:51 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-10-06 04:13:51 (GMT) |
commit | 57ac62376ac140f55deebd457de486305e956cae (patch) | |
tree | 57c62211ef3f915f1217d5a9b96c7f381d05f3ed /Lib | |
parent | 72601e1456093a9022b948d45e67523512407cd0 (diff) | |
download | cpython-57ac62376ac140f55deebd457de486305e956cae.zip cpython-57ac62376ac140f55deebd457de486305e956cae.tar.gz cpython-57ac62376ac140f55deebd457de486305e956cae.tar.bz2 |
Issue #3832: backport 677a9326b4d4 to 2.7 (and delete some obsolete code).
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/idlelib/IOBinding.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index e3affa8..e7d747c 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -19,11 +19,7 @@ from SimpleDialog import SimpleDialog from idlelib.configHandler import idleConf -try: - from codecs import BOM_UTF8 -except ImportError: - # only available since Python 2.3 - BOM_UTF8 = '\xef\xbb\xbf' +from codecs import BOM_UTF8 # Try setting the locale, so that we can find out # what encoding to use @@ -532,6 +528,8 @@ class IOBinding: ("All files", "*"), ] + defaultextension = '.py' if sys.platform == 'darwin' else '' + def askopenfile(self): dir, base = self.defaultfilename("open") if not self.opendialog: @@ -557,8 +555,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) if isinstance(filename, unicode): filename = filename.encode(filesystemencoding) |