REFACTOR-PLUGINS: shared helpers + deutsche Strings durchgaengig
weather.py:
- Custom _draw_compass (~50 Zeilen) entfernt, nutzt jetzt draw_compass
aus plugins/base.py (mit color=RED statt fonts-Argument-Bug)
- Custom temp_color-Logik (ORANGE/BLU/FG) ersetzt durch temp_color() aus palette
- Stunden-Vorhersage zeigt jetzt Wetter-Icon pro Zelle via draw_weather_icon
- Auch im compact-mode: Wetter-Icon oben rechts
- Strings: 'Hum' -> 'Feuchte', 'Dir' -> 'Richtung', 'Aktuelles Wetter' -> 'Vorhersage'
strava.py:
- Doppeltes label='Strava Aktivitäten' am Dateiende entfernt (mojibake-Copy-Paste)
- description: 'Rides' -> 'Fahrten', 'Setze ... unten' sauberer
- Strings: 'rides' -> 'Fahrten' (3x), 'hike' -> 'Wandern' (2x),
'YTD' -> 'Jahr', 'in {year}' -> 'im Jahr {year}', 'Total' -> 'Gesamt'
system.py:
- _fmt_uptime: 'd/h/m' -> 'T/h/min' (deutsche Tages-Notation)
- Strings: 'up ' -> 'laeuft ' (in wide + standard), 'load ' -> 'Last '
minimax.py:
- _fmt_timedelta_short: 'now' -> 'jetzt', 'Xd Yh' -> 'XT Yh', 'Ym' -> 'Ymin'
(deutsche Kurz-Laufzeit, konsistent mit system.py)
clock_wordclock.py:
- Locale-abhaengige strftime('%A') / strftime('%e. %b %Y') durch
de_weekday_long() / de_date() aus palette ersetzt
- Vorher: auf nicht-de_DE-Systemen wurde 'Wednesday' statt 'Mittwoch' angezeigt
Verifikation: alle 9 Plugins importieren sauber, weather rendert mit
shared helpers (docs/test_weather.png).
This commit is contained in:
+7
-6
@@ -34,12 +34,13 @@ def _read_uptime():
|
||||
|
||||
|
||||
def _fmt_uptime(s):
|
||||
"""Formatiert Sekunden als deutsche Laufzeit: '3T 5h', '7h 12min', '42min'."""
|
||||
days, rem = divmod(int(s), 86400)
|
||||
h, rem = divmod(rem, 3600)
|
||||
m = rem // 60
|
||||
if days: return f"{days}d {h}h"
|
||||
if h: return f"{h}h {m}m"
|
||||
return f"{m}m"
|
||||
if days: return f"{days}T {h}h"
|
||||
if h: return f"{h}h {m}min"
|
||||
return f"{m}min"
|
||||
|
||||
|
||||
def _system_stats():
|
||||
@@ -122,7 +123,7 @@ class Widget(Widget):
|
||||
draw.text((cx + pad, y + pad), f"{label} {pct}%",
|
||||
font=label_font, fill=col_color)
|
||||
if self.cfg("show_uptime"):
|
||||
up_str = "up " + _fmt_uptime(s["uptime_s"])
|
||||
up_str = "läuft " + _fmt_uptime(s["uptime_s"])
|
||||
font_up = fit_font(draw, up_str, fonts, col_w - 2 * pad, 22)
|
||||
draw.text((x + 2 * col_w + pad, y + pad), up_str, font=font_up, fill=INFO)
|
||||
return
|
||||
@@ -155,9 +156,9 @@ class Widget(Widget):
|
||||
if self.cfg("show_load") or self.cfg("show_uptime"):
|
||||
parts = []
|
||||
if self.cfg("show_load"):
|
||||
parts.append(f"load {s['cpu_pct']/100.0 * (os.cpu_count() or 1):.2f}")
|
||||
parts.append(f"Last {s['cpu_pct']/100.0 * (os.cpu_count() or 1):.2f}")
|
||||
if self.cfg("show_uptime"):
|
||||
parts.append("up " + _fmt_uptime(s["uptime_s"]))
|
||||
parts.append("läuft " + _fmt_uptime(s["uptime_s"]))
|
||||
line = " · ".join(parts)
|
||||
font_bot = fit_font(draw, line, fonts, w - 2 * pad, 22)
|
||||
draw.text((x + pad, bottom_y), line, font=font_bot, fill=FG)
|
||||
|
||||
Reference in New Issue
Block a user