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 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'planner/planner_generator.py') 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): """ """ -- cgit v1.2.3