From 535a3806169ff3beda05db69d079d7f8f8dcbb44 Mon Sep 17 00:00:00 2001 From: Miguel Jacq Date: Mon, 1 Dec 2025 10:27:44 +1100 Subject: [PATCH] Ensure time log reports have an extension --- CHANGELOG.md | 1 + bouquin/time_log.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2f6412..c236ffb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Add + button to time log widget in side bar to have a simplified log entry dialog (without summary or report option) * Allow click-and-drag mouse select on lines with checkbox, to capture the checkbox as well as the text. * Allow changing the date when logging time (rather than having to go to that date before clicking on adding time log/opening time log manager) + * Ensure time log reports have an extension # 0.5.4 diff --git a/bouquin/time_log.py b/bouquin/time_log.py index 7e6ebfa..bf45680 100644 --- a/bouquin/time_log.py +++ b/bouquin/time_log.py @@ -1076,6 +1076,8 @@ class TimeReportDialog(QDialog): ) if not filename: return + if not filename.endswith(".csv"): + filename = f"{filename}.csv" try: with open(filename, "w", newline="", encoding="utf-8") as f: @@ -1124,6 +1126,8 @@ class TimeReportDialog(QDialog): ) if not filename: return + if not filename.endswith(".pdf"): + filename = f"{filename}.pdf" # ---------- Build chart image (hours per period) ---------- per_period_minutes: dict[str, int] = defaultdict(int)