diff --git a/screens/journey.py b/screens/journey.py index 6bbcfea..4ac7c69 100644 --- a/screens/journey.py +++ b/screens/journey.py @@ -350,13 +350,17 @@ class JourneyScreen(Screen): draw.text((arrow_x + arrow_w + scale * 0.02, top_line_y), journey["arrival"], font=time_font, fill=BLACK) - # Detail line: a colored dot per leg (blue = train, green = bus -- - # pure panel colors, no dithering) followed by its line name, then - # transfer/platform/notice info. Drawn as manually-placed segments - # instead of one joined string so each leg can carry its own dot. + # Detail line: a small badge per leg -- colored circle (blue = + # train, green = bus; pure panel colors, no dithering) with a + # "Z" (Zug) or "B" (Bus) letter in it, so the mode is legible at + # a glance rather than relying on color alone. Followed by the + # line name, then transfer/platform/notice info. Drawn as + # manually-placed segments instead of one joined string so each + # leg can carry its own badge. detail_y = top_line_y + time_font.size * 1.25 right_edge = width - pad - icon_d = detail_font.size * 0.55 + icon_d = detail_font.size * 0.9 + icon_font = load_font(size=max(8, int(icon_d * 0.62)), bold=True) cursor_x = pad def draw_segment(text, color=BLACK, avail=None): @@ -367,12 +371,19 @@ class JourneyScreen(Screen): cursor_x += text_width(draw, text, detail_font) return text + def draw_mode_icon(x, mode): + color = BLUE if mode == "train" else GREEN + letter = "Z" if mode == "train" else "B" + top = detail_y + (detail_font.size - icon_d) / 2 + draw.ellipse((x, top, x + icon_d, top + icon_d), fill=color) + l, t, r, b = draw.textbbox((0, 0), letter, font=icon_font) + lw, lh = r - l, b - t + draw.text((x + (icon_d - lw) / 2 - l, top + (icon_d - lh) / 2 - t), letter, font=icon_font, fill=(255, 255, 255)) + for idx, leg in enumerate(journey["legs"]): if cursor_x >= right_edge - icon_d: break - dot_color = BLUE if leg["mode"] == "train" else GREEN - dot_top = detail_y + (detail_font.size - icon_d) / 2 - draw.ellipse((cursor_x, dot_top, cursor_x + icon_d, dot_top + icon_d), fill=dot_color) + draw_mode_icon(cursor_x, leg["mode"]) cursor_x += icon_d + scale * 0.01 shown = draw_segment(leg["name"], avail=right_edge - cursor_x)