mendhak / waveshare-epaper-display

At-a-glance dashboard for Raspberry Pi with a Waveshare ePaper 7.5 Inch HAT. Date/Time, Weather, Alerts, Google/Outlook Calendar
https://code.mendhak.com/raspberrypi-epaper-dashboard/
449 stars 66 forks source link

Add a new template with monthly calendar #74

Closed jasompi closed 8 months ago

jasompi commented 8 months ago

The new screen-template.5.svg include a monthly calendar.

Screenshot

mendhak commented 8 months ago

I like this template, it's useful for at a glance calendar events and where you are in the month.

I see a problem, I think the days are off - the screenshot shows Jan 12 as Thursday, but should have been a Friday. I just ran it locally and it's showing Jan 20 = Friday but should be Saturday.

Could you correct that so the month is correctly rendered.

jasompi commented 8 months ago

I like this template, it's useful for at a glance calendar events and where you are in the month.

I see a problem, I think the days are off - the screenshot shows Jan 12 as Thursday, but should have been a Friday. I just ran it locally and it's showing Jan 20 = Friday but should be Saturday.

Could you correct that so the month is correctly rendered.

Fixed by using the Calendar.weekheader(2) to get the weekheader.

mendhak commented 8 months ago

Hey @jasompi I did a bit of modifying, I couldn't push to your branch so started a new PR.

I wanted to respect locales - both day names as well as using locale specific first-day-of-week. Example in US it's Sunday but EU it's Monday but Iran it's Saturday.

Also I used a library drawsvg to draw the month calendar, it's a bit longer code but the SVG is much smaller and potentially the calendar generation code becomes reusable if someone wants to put it in another template.

Have a look at the branch in progress, I think I've managed to replicate what you did: https://github.com/mendhak/waveshare-epaper-display/pull/77/files#diff-c646c4a352115b8c5dda6a5348c6540a2db4f6b8114b64875f9cf36684d78a61

Example with locales:

ko_KR

image

en_US

image

en_GB

image

Just doing a bit more testing and then I should be able to merge it