Skip to content

Commit 424a415

Browse files
committed
Make CREDITS.txt a Latin-1 file. Extend ViewFile to support file encodings.
1 parent 04b9d47 commit 424a415

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Lib/idlelib/CREDITS.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Other contributors include Raymond Hettinger, Tony Lownds (Mac integration),
2222
Neal Norwitz (code check and clean-up), and Chui Tey (RPC integration, debugger
2323
integration and persistent breakpoints).
2424

25-
Hernan Foffani, Christos Georgiou, Martin v. Loewis, Jason Orendorff, Noam
25+
Hernan Foffani, Christos Georgiou, Martin v. L�wis, Jason Orendorff, Noam
2626
Raphael, Josh Robb, Nigel Rowe, and Bruce Sherwood have submitted useful
2727
patches. Thanks, guys!
2828

Lib/idlelib/aboutDialog.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def ShowPythonCredits(self):
118118
self.display_printer_text(credits, 'About - Python Credits')
119119

120120
def ShowIDLECredits(self):
121-
self.ViewFile('About - Credits','CREDITS.txt')
121+
self.ViewFile('About - Credits','CREDITS.txt', 'iso-8859-1')
122122

123123
def ShowIDLEAbout(self):
124124
self.ViewFile('About - Readme', 'README.txt')
@@ -131,9 +131,22 @@ def display_printer_text(self, printer, title):
131131
data = '\n'.join(printer._Printer__lines)
132132
textView.TextViewer(self, title, None, data)
133133

134-
def ViewFile(self,viewTitle,viewFile):
134+
def ViewFile(self, viewTitle, viewFile, encoding=None):
135135
fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile)
136-
textView.TextViewer(self,viewTitle,fn)
136+
if encoding:
137+
import codecs
138+
try:
139+
textFile = codecs.open(fn, 'r')
140+
except IOError:
141+
tkMessageBox.showerror(title='File Load Error',
142+
message='Unable to load file '+
143+
`fileName`+' .')
144+
return
145+
else:
146+
data = textFile.read()
147+
else:
148+
data = None
149+
textView.TextViewer(self, viewTitle, fn, data=data)
137150

138151
def Ok(self, event=None):
139152
self.destroy()

0 commit comments

Comments
 (0)