update layout
This commit is contained in:
parent
3cc831ba72
commit
5bcaa84bfb
@ -28,7 +28,7 @@ def display_loop(api: Api, cfg: Dict):
|
||||
bg = Image.new("RGB", (d.height, d.width), (0, 0, 0))
|
||||
d.ShowImage(bg)
|
||||
|
||||
Font0 = ImageFont.truetype("Font/GothamMedium.ttf", 13)
|
||||
Font0 = ImageFont.truetype("Font/GothamBold.ttf", 13)
|
||||
Font1 = ImageFont.truetype("Font/GothamMedium.ttf", 18)
|
||||
Font1b = ImageFont.truetype("Font/GothamBold.ttf", 19)
|
||||
Font2 = ImageFont.truetype("Font/GothamMedium.ttf", 20)
|
||||
@ -135,6 +135,7 @@ def display_loop(api: Api, cfg: Dict):
|
||||
|
||||
w, h = bg.size
|
||||
w -= 90
|
||||
h += 4
|
||||
progress_time = min(
|
||||
data["duration_ms"],
|
||||
data["progress_ms"] + int((time.time() - last_api_call) * 1000),
|
||||
@ -142,14 +143,19 @@ def display_loop(api: Api, cfg: Dict):
|
||||
progress = min(1, progress_time / data["duration_ms"])
|
||||
bar_width = int((w - 10) * progress)
|
||||
draw.rectangle(
|
||||
[(8, h - 22), (w + 2, h - 8)],
|
||||
[(9, h - 23), (w + 3, h - 7)],
|
||||
outline=cfg["color_theme"]["text"],
|
||||
)
|
||||
|
||||
draw.rectangle(
|
||||
[(10, h - 22), (w + 2, h - 8)],
|
||||
outline=cfg["color_theme"]["text"],
|
||||
)
|
||||
draw.rectangle(
|
||||
[(10, h - 20), (w, h - 10)], fill=cfg["color_theme"]["background"]
|
||||
[(12, h - 20), (w, h - 10)], fill=cfg["color_theme"]["background"]
|
||||
)
|
||||
draw.rectangle(
|
||||
[(10, h - 20), (10 + bar_width, h - 10)],
|
||||
[(12, h - 20), (12 + bar_width, h - 10)],
|
||||
fill=cfg["color_theme"]["bar_inside"],
|
||||
)
|
||||
f_current_time = "{}:{:02.0f}".format(
|
||||
@ -159,10 +165,10 @@ def display_loop(api: Api, cfg: Dict):
|
||||
*divmod(data["duration_ms"] // 1000, 60)
|
||||
)
|
||||
draw.rectangle(
|
||||
[(239, 215), (320, 235)], fill=cfg["color_theme"]["background"]
|
||||
[(238, 218), (320, 238)], fill=cfg["color_theme"]["background"]
|
||||
)
|
||||
draw.text(
|
||||
(240, 220),
|
||||
(240, 224),
|
||||
f"{f_current_time}/{f_total_time}",
|
||||
font=Font0,
|
||||
fill=cfg["color_theme"]["text"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user