444 @return formatted data string |
444 @return formatted data string |
445 @rtype str |
445 @rtype str |
446 """ |
446 """ |
447 if size < 1024: |
447 if size < 1024: |
448 return QCoreApplication.translate( |
448 return QCoreApplication.translate( |
449 "Globals", "{0:.1f} Bytes").format(size) |
449 "Globals", "{0:4.2f} Bytes").format(size) |
450 elif size < 1024 * 1024: |
450 elif size < 1024 * 1024: |
451 size /= 1024 |
451 size /= 1024 |
452 return QCoreApplication.translate( |
452 return QCoreApplication.translate( |
453 "Globals", "{0:.1f} KiB").format(size) |
453 "Globals", "{0:4.2f} KiB").format(size) |
454 elif size < 1024 * 1024 * 1024: |
454 elif size < 1024 * 1024 * 1024: |
455 size /= 1024 * 1024 |
455 size /= 1024 * 1024 |
456 return QCoreApplication.translate( |
456 return QCoreApplication.translate( |
457 "Globals", "{0:.2f} MiB").format(size) |
457 "Globals", "{0:4.2f} MiB").format(size) |
458 else: |
458 elif size < 1024 * 1024 * 1024 * 1024: |
459 size /= 1024 * 1024 * 1024 |
459 size /= 1024 * 1024 * 1024 |
460 return QCoreApplication.translate( |
460 return QCoreApplication.translate( |
461 "Globals", "{0:.2f} GiB").format(size) |
461 "Globals", "{0:4.2f} GiB").format(size) |
|
462 else: |
|
463 size /= 1024 * 1024 * 1024 * 1024 |
|
464 return QCoreApplication.translate( |
|
465 "Globals", "{0:4.2f} TiB").format(size) |
462 |
466 |
463 |
467 |
464 ############################################################################### |
468 ############################################################################### |
465 ## functions for converting QSetting return types to valid types |
469 ## functions for converting QSetting return types to valid types |
466 ############################################################################### |
470 ############################################################################### |