Skip to content

Commit

Permalink
Moved progress information to window title for more convenient readin…
Browse files Browse the repository at this point in the history
…g by screen readers
  • Loading branch information
cyrmax committed May 21, 2023
1 parent e9d27c2 commit 06d0ec2
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sku-updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,22 +108,23 @@ def update_sku(sku_info: tuple[float, str], sku_path: pathlib.Path):
r.raise_for_status()
downloaded_size = 0
total_size = int(r.headers["Content-Length"])
print(f"{total_size / (1024 * 1024):.2f} MB will be downloaded")
with open(local_filename, "wb") as f:
for chunk in r.iter_content(16384):
f.write(chunk)
f.flush()
downloaded_size += len(chunk)
print("\r", end="")
print(f"{downloaded_size / (1024 * 1024):.2f} MB of {total_size / (1024 * 1024):.2f} MB, {downloaded_size / total_size * 100:.2f}%", end="")
print("")
os.system(f"title {downloaded_size / (1024 * 1024):.2f} MB of {total_size / (1024 * 1024):.2f} MB, {downloaded_size / total_size * 100:.2f}%. Sku Updater")
print("Installing...")
os.system("title installing Sku. Sku Updater")
with zipfile.ZipFile(local_filename, "r") as zf:
zf.extractall(str(sku_path.parent.resolve()))
print("Cleaning...")
os.remove(local_filename)


def main():
os.system("title Sku Updater")
print("Searching World of Warcraft Classic installation...")
try:
wowc_path = find_wowc()
Expand Down

0 comments on commit 06d0ec2

Please sign in to comment.