Handle day event

This commit is contained in:
nemunaire 2022-09-20 09:57:39 +02:00
parent 4d7d1ee0f4
commit ddea221cc4

View File

@ -323,17 +323,31 @@ class IcalModule:
)
align += line_height * 0.7
if "location" in evt and now.day == evt["start"].day:
align += display_longtext(draw,
(2 + fnt_R.getsize(evt["start"].astimezone(pytz.timezone('Europe/Paris')).strftime("%H:%M "))[0], align+line_height*0.6),
evt["location"],
fill="black", anchor="lt", font=fnt_R
)
if isinstance(evt["start"], datetime):
align += display_longtext(draw,
(2 + fnt_R.getsize(evt["start"].astimezone(pytz.timezone('Europe/Paris')).strftime("%H:%M "))[0], align+line_height*0.6),
evt["location"],
fill="black", anchor="lt", font=fnt_R
)
else:
align += display_longtext(draw,
(width/2, align+line_height*0.6),
evt["location"],
fill="black", anchor="mt", font=fnt_R
)
if "info" in evt:
align += display_longtext(draw,
(2 + fnt_R.getsize(evt["start"].astimezone(pytz.timezone('Europe/Paris')).strftime("%H:%M "))[0], align+line_height*0.6),
evt["info"],
fill="black", anchor="lt", font=fnt_R, maxwidth=width - fnt_R.getsize(evt["start"].astimezone(pytz.timezone('Europe/Paris')).strftime("%H:%M "))[0]
)
if isinstance(evt["start"], datetime):
align += display_longtext(draw,
(2 + fnt_R.getsize(evt["start"].astimezone(pytz.timezone('Europe/Paris')).strftime("%H:%M "))[0], align+line_height*0.6),
evt["info"],
fill="black", anchor="lt", font=fnt_R, maxwidth=width - fnt_R.getsize(evt["start"].astimezone(pytz.timezone('Europe/Paris')).strftime("%H:%M "))[0]
)
else:
align += display_longtext(draw,
(width/2, align+line_height*0.6),
evt["info"],
fill="black", anchor="mt", font=fnt_R
)
elif "end" in evt and not isinstance(evt["end"], datetime):
pass
elif "end" in evt and (("new_start" in evt and now > evt["new_start"]) or ("new_start" not in evt and now > evt["start"])):