Commit 57ac6237 authored by Terry Jan Reedy's avatar Terry Jan Reedy

Issue #3832: backport 677a9326b4d4 to 2.7 (and delete some obsolete code).

parent 72601e14
...@@ -19,11 +19,7 @@ from SimpleDialog import SimpleDialog ...@@ -19,11 +19,7 @@ from SimpleDialog import SimpleDialog
from idlelib.configHandler import idleConf from idlelib.configHandler import idleConf
try: from codecs import BOM_UTF8
from codecs import BOM_UTF8
except ImportError:
# only available since Python 2.3
BOM_UTF8 = '\xef\xbb\xbf'
# Try setting the locale, so that we can find out # Try setting the locale, so that we can find out
# what encoding to use # what encoding to use
...@@ -532,6 +528,8 @@ class IOBinding: ...@@ -532,6 +528,8 @@ class IOBinding:
("All files", "*"), ("All files", "*"),
] ]
defaultextension = '.py' if sys.platform == 'darwin' else ''
def askopenfile(self): def askopenfile(self):
dir, base = self.defaultfilename("open") dir, base = self.defaultfilename("open")
if not self.opendialog: if not self.opendialog:
...@@ -557,8 +555,10 @@ class IOBinding: ...@@ -557,8 +555,10 @@ class IOBinding:
def asksavefile(self): def asksavefile(self):
dir, base = self.defaultfilename("save") dir, base = self.defaultfilename("save")
if not self.savedialog: if not self.savedialog:
self.savedialog = tkFileDialog.SaveAs(master=self.text, self.savedialog = tkFileDialog.SaveAs(
filetypes=self.filetypes) master=self.text,
filetypes=self.filetypes,
defaultextension=self.defaultextension)
filename = self.savedialog.show(initialdir=dir, initialfile=base) filename = self.savedialog.show(initialdir=dir, initialfile=base)
if isinstance(filename, unicode): if isinstance(filename, unicode):
filename = filename.encode(filesystemencoding) filename = filename.encode(filesystemencoding)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment