diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2003-06-15 22:28:05 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2003-06-15 22:28:05 (GMT) |
commit | 424a41595166235fdefa33108cde3ea4341dace8 (patch) | |
tree | 396237001bf889d584e61ecd869d2bafdc1183f8 /Lib/idlelib | |
parent | 04b9d47941527503fdc0c57672394529edf13e0d (diff) | |
download | cpython-424a41595166235fdefa33108cde3ea4341dace8.zip cpython-424a41595166235fdefa33108cde3ea4341dace8.tar.gz cpython-424a41595166235fdefa33108cde3ea4341dace8.tar.bz2 |
Make CREDITS.txt a Latin-1 file. Extend ViewFile to support file encodings.
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/CREDITS.txt | 2 | ||||
-rw-r--r-- | Lib/idlelib/aboutDialog.py | 19 |
2 files changed, 17 insertions, 4 deletions
diff --git a/Lib/idlelib/CREDITS.txt b/Lib/idlelib/CREDITS.txt index 62e2f8d..fe77576 100644 --- a/Lib/idlelib/CREDITS.txt +++ b/Lib/idlelib/CREDITS.txt @@ -22,7 +22,7 @@ Other contributors include Raymond Hettinger, Tony Lownds (Mac integration), Neal Norwitz (code check and clean-up), and Chui Tey (RPC integration, debugger integration and persistent breakpoints). -Hernan Foffani, Christos Georgiou, Martin v. Loewis, Jason Orendorff, Noam +Hernan Foffani, Christos Georgiou, Martin v. Löwis, Jason Orendorff, Noam Raphael, Josh Robb, Nigel Rowe, and Bruce Sherwood have submitted useful patches. Thanks, guys! diff --git a/Lib/idlelib/aboutDialog.py b/Lib/idlelib/aboutDialog.py index 94dd6cb..d88cfcc 100644 --- a/Lib/idlelib/aboutDialog.py +++ b/Lib/idlelib/aboutDialog.py @@ -118,7 +118,7 @@ class AboutDialog(Toplevel): self.display_printer_text(credits, 'About - Python Credits') def ShowIDLECredits(self): - self.ViewFile('About - Credits','CREDITS.txt') + self.ViewFile('About - Credits','CREDITS.txt', 'iso-8859-1') def ShowIDLEAbout(self): self.ViewFile('About - Readme', 'README.txt') @@ -131,9 +131,22 @@ class AboutDialog(Toplevel): data = '\n'.join(printer._Printer__lines) textView.TextViewer(self, title, None, data) - def ViewFile(self,viewTitle,viewFile): + def ViewFile(self, viewTitle, viewFile, encoding=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) - textView.TextViewer(self,viewTitle,fn) + if encoding: + import codecs + try: + textFile = codecs.open(fn, 'r') + except IOError: + tkMessageBox.showerror(title='File Load Error', + message='Unable to load file '+ + `fileName`+' .') + return + else: + data = textFile.read() + else: + data = None + textView.TextViewer(self, viewTitle, fn, data=data) def Ok(self, event=None): self.destroy() |