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 = '' | ||||
| 	bytes = int(string) | ||||
| 	if bytes >= 1024: | ||||
| 		bytes /= 1024 | ||||
| 		bytes = round(bytes/1024.,1) | ||||
| 		if bytes >= 1024: | ||||
| 			bytes /= 1024 | ||||
| 			bytes = round(bytes/1024.,1) | ||||
| 			if bytes >= 1024: | ||||
| 				bytes /= 1024 | ||||
| 				bytes = round(bytes/1024.,1) | ||||
| 				suffix = _('%s Gb')  | ||||
| 			else: | ||||
| 				suffix = _('%s Mb')  | ||||
| 		else: | ||||
| 			suffix = _('%s Kb')  | ||||
| 	else: | ||||
| 		if bytes == 1: | ||||
| 			suffix = _('%s byte')  | ||||
| 		else: | ||||
| 			suffix = _('%s bytes')  | ||||
| 		suffix = _('%s b')  | ||||
| 	return suffix % str(bytes) | ||||
| 	 | ||||
| def escape_for_pango_markup(string): | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue