show file size with 1 unit after the floating
point
This commit is contained in:
		
							parent
							
								
									578105a3ef
								
							
						
					
					
						commit
						f700c53fd9
					
				
					 1 changed files with 4 additions and 7 deletions
				
			
		| 
						 | 
					@ -35,21 +35,18 @@ def convert_bytes(string):
 | 
				
			||||||
	suffix = ''
 | 
						suffix = ''
 | 
				
			||||||
	bytes = int(string)
 | 
						bytes = int(string)
 | 
				
			||||||
	if bytes >= 1024:
 | 
						if bytes >= 1024:
 | 
				
			||||||
		bytes /= 1024
 | 
							bytes = round(bytes/1024.,1)
 | 
				
			||||||
		if bytes >= 1024:
 | 
							if bytes >= 1024:
 | 
				
			||||||
			bytes /= 1024
 | 
								bytes = round(bytes/1024.,1)
 | 
				
			||||||
			if bytes >= 1024:
 | 
								if bytes >= 1024:
 | 
				
			||||||
				bytes /= 1024
 | 
									bytes = round(bytes/1024.,1)
 | 
				
			||||||
				suffix = _('%s Gb') 
 | 
									suffix = _('%s Gb') 
 | 
				
			||||||
			else:
 | 
								else:
 | 
				
			||||||
				suffix = _('%s Mb') 
 | 
									suffix = _('%s Mb') 
 | 
				
			||||||
		else:
 | 
							else:
 | 
				
			||||||
			suffix = _('%s Kb') 
 | 
								suffix = _('%s Kb') 
 | 
				
			||||||
	else:
 | 
						else:
 | 
				
			||||||
		if bytes == 1:
 | 
							suffix = _('%s b') 
 | 
				
			||||||
			suffix = _('%s byte') 
 | 
					 | 
				
			||||||
		else:
 | 
					 | 
				
			||||||
			suffix = _('%s bytes') 
 | 
					 | 
				
			||||||
	return suffix % str(bytes)
 | 
						return suffix % str(bytes)
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
def escape_for_pango_markup(string):
 | 
					def escape_for_pango_markup(string):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue