ratp: Don't show more than one line for old alerts
This commit is contained in:
parent
67008b9c57
commit
eb90840b54
@ -219,8 +219,8 @@ def display_longtext(draw, pos, text, font, anchor="lt", maxwidth=9999, maxlines
|
||||
if len(cur) > 0:
|
||||
lines.append(cur)
|
||||
|
||||
maxlines -= 1
|
||||
if maxlines <= 0:
|
||||
if len(lines) >= maxlines:
|
||||
lines = lines[0:maxlines]
|
||||
lines[-1] += "…"
|
||||
break
|
||||
|
||||
|
@ -264,9 +264,11 @@ class RATPWeatherModule:
|
||||
title = ""
|
||||
subtitle = ""
|
||||
content = ""
|
||||
oneline = False
|
||||
|
||||
if "application_periods" in disruption:
|
||||
now = datetime.now()
|
||||
yesterday = now + timedelta(days=-1)
|
||||
nextweek = now + timedelta(days=1)
|
||||
|
||||
application_periods = []
|
||||
@ -283,6 +285,9 @@ class RATPWeatherModule:
|
||||
else:
|
||||
application_periods.append(ap)
|
||||
|
||||
if ap["begin"] < yesterday:
|
||||
oneline = True
|
||||
|
||||
if len(application_periods) == 0:
|
||||
continue
|
||||
elif len(application_periods) == 1:
|
||||
@ -303,6 +308,7 @@ class RATPWeatherModule:
|
||||
"subtitle": subtitle,
|
||||
"description": content,
|
||||
"icon": alert_icon(mode, line),
|
||||
"oneline": oneline,
|
||||
}
|
||||
|
||||
def draw_module(self, config, width, height, line_height=19):
|
||||
|
Loading…
x
Reference in New Issue
Block a user