diff --git a/CHANGELOG.md b/CHANGELOG.md index a27c1c4..55af76b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Represent in the History diff pane when an image was the thing that changed * Support theme choice in settings (light/dark/system) * Add Checkboxes in the editor. Typing 'TODO' at the start of a line will auto-convert into a checkbox. + * Add option to automatically move yesterday's unchecked TODOs to today on startup # 0.1.9 diff --git a/bouquin/db.py b/bouquin/db.py index e8c4903..20261eb 100644 --- a/bouquin/db.py +++ b/bouquin/db.py @@ -20,6 +20,7 @@ class DBConfig: key: str idle_minutes: int = 15 # 0 = never lock theme: str = "system" + move_todos: bool = False class DBManager: diff --git a/bouquin/editor.py b/bouquin/editor.py index 05ef128..5abf9b8 100644 --- a/bouquin/editor.py +++ b/bouquin/editor.py @@ -886,5 +886,12 @@ class Editor(QTextEdit): def setHtml(self, html: str) -> None: super().setHtml(html) + + doc = self.document() + block = doc.firstBlock() + while block.isValid(): + self._style_checkbox_glyph(block) # Apply checkbox styling to each block + block = block.next() + # Ensure anchors adopt the palette color on startup self._retint_anchors_to_palette() diff --git a/bouquin/main_window.py b/bouquin/main_window.py index 7c9d1d0..9243177 100644 --- a/bouquin/main_window.py +++ b/bouquin/main_window.py @@ -3,6 +3,7 @@ from __future__ import annotations import datetime import os import sys +import re from pathlib import Path from PySide6.QtCore import ( @@ -224,7 +225,8 @@ class MainWindow(QMainWindow): self.editor.textChanged.connect(self._on_text_changed) # First load + mark dates in calendar with content - self._load_selected_date() + if not self._load_yesterday_todos(): + self._load_selected_date() self._refresh_calendar_marks() # Restore window position from settings @@ -469,17 +471,31 @@ class MainWindow(QMainWindow): d = self.calendar.selectedDate() return f"{d.year():04d}-{d.month():02d}-{d.day():02d}" - def _load_selected_date(self, date_iso=False): + def _load_selected_date(self, date_iso=False, extra_data=False): if not date_iso: date_iso = self._current_date_iso() try: text = self.db.get_entry(date_iso) + if extra_data: + # Wrap extra_data in a
tag for HTML rendering + extra_data_html = f"
{extra_data}
" + + # Inject the extra_data before the closing