Skip to content

Commit 0fbe0e4

Browse files
committed
more accurate size unit for backup size display
1 parent d655f5c commit 0fbe0e4

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

quick_backup_multi/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,12 +520,12 @@ def get_dir_size(dir_: str):
520520

521521
def format_dir_size(size: int):
522522
if size < 2 ** 30:
523-
return f'{round(size / 2 ** 20, 2)} MB'
523+
return '{} MiB'.format(round(size / 2 ** 20, 2))
524524
else:
525-
return f'{round(size / 2 ** 30, 2)} GB'
525+
return '{} GiB'.format(round(size / 2 ** 30, 2))
526526

527527
print_message(source, tr('list_backup.title'), prefix='')
528-
backup_size = 0
528+
total_backup_size = 0
529529
for i in range(get_slot_count()):
530530
slot_idx = i + 1
531531
slot_info = get_slot_info(slot_idx)
@@ -534,7 +534,7 @@ def format_dir_size(size: int):
534534
dir_size = get_dir_size(get_slot_path(slot_idx))
535535
else:
536536
dir_size = 0
537-
backup_size += dir_size
537+
total_backup_size += dir_size
538538
# noinspection PyTypeChecker
539539
text = RTextList(
540540
RText(tr('list_backup.slot.header', slot_idx)).h(tr('list_backup.slot.protection', format_protection_time(config.slots[slot_idx - 1].delete_protection))),
@@ -550,7 +550,7 @@ def format_dir_size(size: int):
550550
text += formatted_slot_info
551551
print_message(source, text, prefix='')
552552
if size_display:
553-
print_message(source, tr('list_backup.total_space', format_dir_size(backup_size)), prefix='')
553+
print_message(source, tr('list_backup.total_space', format_dir_size(total_backup_size)), prefix='')
554554

555555

556556
@new_thread('QBM - help')

0 commit comments

Comments
 (0)