From: Edward Delaporte Date: Sun, 22 Feb 2026 23:00:21 +0000 (-0600) Subject: Update PDF generation X-Git-Url: https://us-delaporte.pagekite.me/gitweb/dotfiles.git/commitdiff_plain/25ba79cb8d5f06f9cd79c9cf670eb5b32cb2e68c?hp=9a91c5dc92073c2c744e10aa0bc6c8dfd913bb6d Update PDF generation --- diff --git a/invoke/school/requirements.txt b/invoke/school/requirements.txt index e436f08..afa0944 100644 --- a/invoke/school/requirements.txt +++ b/invoke/school/requirements.txt @@ -1,3 +1,5 @@ invoke +markdown pandas_ods_reader pdfkit +weasyprint diff --git a/invoke/school/tasks.py b/invoke/school/tasks.py index 5be7ba6..d311f61 100644 --- a/invoke/school/tasks.py +++ b/invoke/school/tasks.py @@ -2,7 +2,7 @@ from invoke import task from pandas_ods_reader import read_ods import pandas as pd -import pdfkit +from weasyprint import HTML from datetime import datetime as dt from datetime import timedelta @@ -27,8 +27,9 @@ def code(c, path): def folder(c, path): - c.run(f'dolphin {path}', asynchronous=True) + # c.run(f'dolphin {path}', asynchronous=True) # c.run(f"nemo {path}") + c.run(f'konsole --workdir {path}',asynchronous=True) @task @@ -84,7 +85,11 @@ def preview_all(c, monday): def make_all(c, monday): html_all(c, monday) for person in STUDENTS: - pdfkit.from_file(f'{SCHOOL_DIR}/{person}.{monday}.html', f'{SCHOOL_DIR}/{person}.{monday}.pdf', options={"enable-local-file-access": True}) + html = f'{SCHOOL_DIR}/{person}.{monday}.html' + pdf = f'{SCHOOL_DIR}/{person}.{monday}.pdf' + HTML(html).write_pdf(pdf) + c.run(f'librewolf {SCHOOL_DIR}/{person}.{monday}.pdf', asynchronous=True) + def get_todays_assignments(df, date, person): mine = df[df['person'] == person] @@ -95,7 +100,7 @@ def get_todays_assignments(df, date, person): def missing_on_day(c, person, day): df = read_ods(ODS_FILE) today = get_todays_assignments(df, day, person) - for subject in ['College Prep', 'Life Skills', 'Job Prep']: + for subject in ['College Prep', 'Life Skills', 'Job Prep', 'Health']: if not 'All Day Event' in today['subject'].values and not subject in today['subject'].values: print(f'Missing {subject} for {person} on {day}') @@ -162,3 +167,11 @@ def fresh_week(c): c.run(f'mv {SCHOOL_DIR}/*.pdf {ARCHIVE}') +@task +def checklist(c): + print('- [ ] `fresh-week` to clean up old files.') + print('- [ ] start libreoffice and open `assignements.ods`') + print('- [ ] copy a previous sheet to be the new first sheet, and update the date Monday date.') + print('- [ ] `invoke missing YYYY.MM.DD` the .ods file.') + print('- [ ] `invoke preview-all YYYY.MM.DD`') +