mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 02:15:10 +00:00 
			
		
		
		
	Make CREDITS.txt a Latin-1 file. Extend ViewFile to support file encodings.
This commit is contained in:
		
							parent
							
								
									04b9d47941
								
							
						
					
					
						commit
						424a415951
					
				
					 2 changed files with 17 additions and 4 deletions
				
			
		|  | @ -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 | Neal Norwitz (code check and clean-up), and Chui Tey (RPC integration, debugger | ||||||
| integration and persistent breakpoints). | 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 | Raphael, Josh Robb, Nigel Rowe, and Bruce Sherwood have submitted useful | ||||||
| patches.  Thanks, guys! | patches.  Thanks, guys! | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -118,7 +118,7 @@ class AboutDialog(Toplevel): | ||||||
|         self.display_printer_text(credits, 'About - Python Credits') |         self.display_printer_text(credits, 'About - Python Credits') | ||||||
| 
 | 
 | ||||||
|     def ShowIDLECredits(self): |     def ShowIDLECredits(self): | ||||||
|         self.ViewFile('About - Credits','CREDITS.txt') |         self.ViewFile('About - Credits','CREDITS.txt', 'iso-8859-1') | ||||||
| 
 | 
 | ||||||
|     def ShowIDLEAbout(self): |     def ShowIDLEAbout(self): | ||||||
|         self.ViewFile('About - Readme', 'README.txt') |         self.ViewFile('About - Readme', 'README.txt') | ||||||
|  | @ -131,9 +131,22 @@ class AboutDialog(Toplevel): | ||||||
|         data = '\n'.join(printer._Printer__lines) |         data = '\n'.join(printer._Printer__lines) | ||||||
|         textView.TextViewer(self, title, None, data) |         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) |         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): |     def Ok(self, event=None): | ||||||
|         self.destroy() |         self.destroy() | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Martin v. Löwis
						Martin v. Löwis