Bring back fancy progress output

Former-commit-id: 56b8eca4b11165947049c0e978550fd71abb61f8
This commit is contained in:
2023-10-14 15:07:16 -07:00
parent 48bc018adb
commit 6eb1f81068
3 changed files with 22 additions and 3 deletions

View File

@@ -15,6 +15,7 @@ import json
import os
import platform
import sys
import math
from pathlib import Path
from . import ninja_syntax
@@ -875,8 +876,12 @@ def calculate_progress(config):
def __init__(self, name):
self.name = name
self.code_total = 0
self.code_fancy_frac = 1499
self.code_fancy_item = "energy"
self.code_progress = 0
self.data_total = 0
self.data_fancy_frac = 250
self.data_fancy_item = "missiles"
self.data_progress = 0
self.objects_progress = 0
self.objects_total = 0
@@ -947,6 +952,16 @@ def calculate_progress(config):
)
print(f" Code: {unit.code_progress} / {unit.code_total} bytes")
print(f" Data: {unit.data_progress} / {unit.data_total} bytes")
print(
"\nYou have {} out of {} {} and collected {} out of {} {}.".format(
math.floor(code_frac * unit.code_fancy_frac),
unit.code_fancy_frac,
unit.code_fancy_item,
math.floor(data_frac * unit.data_fancy_frac),
unit.data_fancy_frac,
unit.data_fancy_item,
)
)
if all_progress:
print_category(all_progress)
@@ -979,4 +994,4 @@ def calculate_progress(config):
for progress in modules_progress:
add_category(progress.name, progress)
with open(out_path / "progress.json", "w", encoding="utf-8") as w:
json.dump(progress_json, w, indent=4)
json.dump(progress_json, w, indent=4)