This commit is contained in:
barry 2025-01-11 18:48:26 +01:00
parent ffb6fd0955
commit 7ee49b9cf6

View File

@ -138,13 +138,20 @@ def display_loop(api: Api, cfg: Dict):
w, h = bg.size w, h = bg.size
w -= 95 w -= 95
progress_time = data["progress_ms"] + int( progress_time = min(
(time.time() - last_api_call) * 1000 data["duration_ms"],
data["progress_ms"] + int((time.time() - last_api_call) * 1000),
) )
progress = min(1, progress_time / data["duration_ms"]) progress = min(1, progress_time / data["duration_ms"])
bar_width = int(w * progress) bar_width = int(w * progress)
draw.rectangle(
[(7, h - 23), (w + 3, h - 7)],
# outline=cfg["color_theme"]["text"],
outline=cfg["color_theme"]["bar_outline"],
)
draw.rectangle( draw.rectangle(
[(8, h - 22), (w + 2, h - 8)], [(8, h - 22), (w + 2, h - 8)],
# outline=cfg["color_theme"]["text"],
outline=cfg["color_theme"]["bar_outline"], outline=cfg["color_theme"]["bar_outline"],
) )
draw.rectangle( draw.rectangle(