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
+2
-8
@@ -5,16 +5,10 @@ import time
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
from screens.base import Screen
|
||||
from screens.render_utils import load_font, text_width
|
||||
from screens.render_utils import format_date_de, load_font, text_width
|
||||
|
||||
LINE_GAP = 0.04 # fraction of min(width, height) between the time and date lines
|
||||
|
||||
WEEKDAYS_DE = ["Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag"]
|
||||
MONTHS_DE = [
|
||||
"Januar", "Februar", "März", "April", "Mai", "Juni",
|
||||
"Juli", "August", "September", "Oktober", "November", "Dezember",
|
||||
]
|
||||
|
||||
|
||||
class ClockScreen(Screen):
|
||||
id = "clock"
|
||||
@@ -31,7 +25,7 @@ class ClockScreen(Screen):
|
||||
|
||||
now = time.localtime()
|
||||
time_str = state or time.strftime("%H:%M", now)
|
||||
date_str = f"{WEEKDAYS_DE[now.tm_wday]}, {now.tm_mday}. {MONTHS_DE[now.tm_mon - 1]}"
|
||||
date_str = format_date_de(now)
|
||||
|
||||
scale = min(width, height)
|
||||
time_font = load_font(size=int(scale * 0.32), bold=True)
|
||||
|
||||
Reference in new issue
Block a user