fix ResourceWarnings. py3 way
This commit is contained in:
		
							parent
							
								
									785f8098b6
								
							
						
					
					
						commit
						1a3d2fc179
					
				
					 1 changed files with 8 additions and 13 deletions
				
			
		| 
						 | 
					@ -1270,9 +1270,8 @@ class AboutDialog:
 | 
				
			||||||
        dlg.set_copyright(s)
 | 
					        dlg.set_copyright(s)
 | 
				
			||||||
        copying_file_path = self.get_path('COPYING')
 | 
					        copying_file_path = self.get_path('COPYING')
 | 
				
			||||||
        if copying_file_path:
 | 
					        if copying_file_path:
 | 
				
			||||||
            fp = open(copying_file_path)
 | 
					            with open(copying_file_path) as a_file:
 | 
				
			||||||
            text = fp.read()
 | 
					                text = a_file.read()
 | 
				
			||||||
            fp.close()
 | 
					 | 
				
			||||||
            dlg.set_license(text)
 | 
					            dlg.set_license(text)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        gtk_ver = '%i.%i.%i' % (Gtk.get_major_version(),
 | 
					        gtk_ver = '%i.%i.%i' % (Gtk.get_major_version(),
 | 
				
			||||||
| 
						 | 
					@ -1285,9 +1284,8 @@ class AboutDialog:
 | 
				
			||||||
        authors_file_path = self.get_path('AUTHORS')
 | 
					        authors_file_path = self.get_path('AUTHORS')
 | 
				
			||||||
        if authors_file_path:
 | 
					        if authors_file_path:
 | 
				
			||||||
            authors = []
 | 
					            authors = []
 | 
				
			||||||
            fp = open(authors_file_path)
 | 
					            with open(authors_file_path) as a_file:
 | 
				
			||||||
            authors_file = fp.read()
 | 
					                authors_file = a_file.read()
 | 
				
			||||||
            fp.close()
 | 
					 | 
				
			||||||
            authors_file = authors_file.split('\n')
 | 
					            authors_file = authors_file.split('\n')
 | 
				
			||||||
            for author in authors_file:
 | 
					            for author in authors_file:
 | 
				
			||||||
                if author == 'CURRENT DEVELOPERS:':
 | 
					                if author == 'CURRENT DEVELOPERS:':
 | 
				
			||||||
| 
						 | 
					@ -1300,10 +1298,8 @@ class AboutDialog:
 | 
				
			||||||
            thanks_file_path = self.get_path('THANKS')
 | 
					            thanks_file_path = self.get_path('THANKS')
 | 
				
			||||||
            if thanks_file_path:
 | 
					            if thanks_file_path:
 | 
				
			||||||
                authors.append('\n' + _('THANKS:'))
 | 
					                authors.append('\n' + _('THANKS:'))
 | 
				
			||||||
 | 
					                with open(thanks_file_path) as a_file:
 | 
				
			||||||
                fp = open(thanks_file_path)
 | 
					                    text = a_file.read()
 | 
				
			||||||
                text = fp.read()
 | 
					 | 
				
			||||||
                fp.close()
 | 
					 | 
				
			||||||
                text_splitted = text.split('\n')
 | 
					                text_splitted = text.split('\n')
 | 
				
			||||||
                text = '\n'.join(text_splitted[:-2]) # remove one english sentence
 | 
					                text = '\n'.join(text_splitted[:-2]) # remove one english sentence
 | 
				
			||||||
                # and add it manually as translatable
 | 
					                # and add it manually as translatable
 | 
				
			||||||
| 
						 | 
					@ -1323,9 +1319,8 @@ class AboutDialog:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        thanks_artists_file_path = self.get_path('THANKS.artists')
 | 
					        thanks_artists_file_path = self.get_path('THANKS.artists')
 | 
				
			||||||
        if thanks_artists_file_path:
 | 
					        if thanks_artists_file_path:
 | 
				
			||||||
            fp = open(thanks_artists_file_path)
 | 
					            with open(thanks_artists_file_path) as a_file:
 | 
				
			||||||
            artists_text = fp.read()
 | 
					                artists_text = a_file.read()
 | 
				
			||||||
            fp.close()
 | 
					 | 
				
			||||||
            artists = artists_text.split('\n')
 | 
					            artists = artists_text.split('\n')
 | 
				
			||||||
            dlg.set_artists(artists)
 | 
					            dlg.set_artists(artists)
 | 
				
			||||||
        # connect close button to destroy() function
 | 
					        # connect close button to destroy() function
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue