From 74b093038c7437c99e6c2296854f11adc4f7dc38 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Fri, 23 Aug 2024 20:59:33 +0200 Subject: Biweekly planner --- planner/planner_generator.py | 25 +++ planner/templates/week_on_one_page-A6-r.svg | 311 ++++++++++++++++++++++++++++ planner/templates/week_on_one_page-A6-v.svg | 311 ++++++++++++++++++++++++++++ 3 files changed, 647 insertions(+) create mode 100644 planner/templates/week_on_one_page-A6-r.svg create mode 100644 planner/templates/week_on_one_page-A6-v.svg diff --git a/planner/planner_generator.py b/planner/planner_generator.py index d748fff..5d9e397 100755 --- a/planner/planner_generator.py +++ b/planner/planner_generator.py @@ -236,6 +236,31 @@ class DailyGenerator(Generator): return pdf_pages +class BiweeklyGenerator(Generator): + """ + """ + default_template = "week_on_one_page-A6" + + def generate_pages(self): + cal = calendar.Calendar() + weeks = sum( + [r[0] for r in cal.yeardatescalendar(self.year, width=1)], + [] + ) + + last_monday = None + page = 1 + for week in weeks: + # yeardatescalendar will have the same week twice at the + # margin of a month, but we want to skip one of those + if week[0] == last_monday: + continue + last_monday = week[0] + + self.render_page(page=page, week=week) + page += 1 + + class MonthGenerator(Generator): """ """ diff --git a/planner/templates/week_on_one_page-A6-r.svg b/planner/templates/week_on_one_page-A6-r.svg new file mode 100644 index 0000000..51d01fa --- /dev/null +++ b/planner/templates/week_on_one_page-A6-r.svg @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + {{ week[-1].strftime('%Y') }} + {{ week[-1].strftime('%B') }} + + + + + + {{ week[0].strftime('%A') }} + {{ week[0].strftime('%d') }} + {{ week[1].strftime('%A') }} + {{ week[1].strftime('%d') }} + {{ week[2].strftime('%A') }} + {{ week[2].strftime('%d') }} + {{ week[3].strftime('%A') }} + {{ week[3].strftime('%d') }} + + + + {{ week[4].strftime('%A') }} + {{ week[4].strftime('%d') }} + {{ week[5].strftime('%A') }} + {{ week[5].strftime('%d') }} + {{ week[6].strftime('%A') }} + {{ week[6].strftime('%d') }} + notes + + diff --git a/planner/templates/week_on_one_page-A6-v.svg b/planner/templates/week_on_one_page-A6-v.svg new file mode 100644 index 0000000..9f07bd9 --- /dev/null +++ b/planner/templates/week_on_one_page-A6-v.svg @@ -0,0 +1,311 @@ + + + + + + + + + + + + + + + + + + + {{ week[0].strftime('%Y') }} + {{ week[0].strftime('%B') }} + {{ week[0].strftime('%A') }} + {{ week[0].strftime('%d') }} + {{ week[1].strftime('%A') }} + {{ week[1].strftime('%d') }} + {{ week[2].strftime('%A') }} + {{ week[2].strftime('%d') }} + {{ week[3].strftime('%A') }} + {{ week[3].strftime('%d') }} + + + + {{ week[4].strftime('%A') }} + {{ week[4].strftime('%d') }} + {{ week[5].strftime('%A') }} + {{ week[5].strftime('%d') }} + {{ week[6].strftime('%A') }} + {{ week[6].strftime('%d') }} + notes + + -- cgit v1.2.3