Weather: default to 5-day forecast, add weekday+date header line
- forecast_days now defaults to 5 (was 3) across default_settings(),
check()'s fallback, and the settings form's pre-selected option.
- New show_date setting (on by default): weekday + date in the same
"Samstag, 25. Juli" format Clock already used. Combined with the
city name into one header line above the icon/temp block when both
are on ("Münster · Samstag, 25. Juli"), each independently
toggleable.
- Moved the weekday/month name lists and the "Weekday, D. Month"
formatting out of clock.py into render_utils.format_date_de(), so
Weather reuses the exact same formatting instead of a second copy
that could drift.
This commit is contained in:
1 parent
78337a99d2
commit
7601f746fe
5 files changed
+50
-32
No files matched your search
@@ -6,6 +6,7 @@ dithering by default) -- so screens can draw with normal anti-aliased RGB
|
||||
text and full-color cover art without worrying about the palette themselves.
|
||||
"""
|
||||
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image, ImageFont
|
||||
@@ -14,6 +15,17 @@ FONTS_DIR = Path(__file__).resolve().parent.parent / "fonts"
|
||||
|
||||
_font_cache: dict[tuple[str, int], ImageFont.FreeTypeFont] = {}
|
||||
|
||||
WEEKDAYS_DE = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"]
|
||||
MONTHS_DE = [
|
||||
"Januar", "Februar", "März", "April", "Mai", "Juni",
|
||||
"Juli", "August", "September", "Oktober", "November", "Dezember",
|
||||
]
|
||||
|
||||
|
||||
def format_date_de(t: time.struct_time | None = None) -> str:
|
||||
t = t or time.localtime()
|
||||
return f"{WEEKDAYS_DE[t.tm_wday]}, {t.tm_mday}. {MONTHS_DE[t.tm_mon - 1]}"
|
||||
|
||||
|
||||
def load_font(size: int, bold: bool = False) -> ImageFont.FreeTypeFont:
|
||||
key = ("bold" if bold else "regular", size)
|
||||
|
||||
Reference in new issue
Block a user