diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2024-08-23 20:59:33 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2024-08-23 20:59:33 +0200 |
commit | 74b093038c7437c99e6c2296854f11adc4f7dc38 (patch) | |
tree | f43cd351955e6802000d5b8f12a3329410ed756c /planner/planner_generator.py | |
parent | 636f4650f810897b1542f6bd537735ba8794c2bb (diff) |
Biweekly planner
Diffstat (limited to 'planner/planner_generator.py')
-rwxr-xr-x | planner/planner_generator.py | 25 |
1 files changed, 25 insertions, 0 deletions
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): """ """ |