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)

This commit is contained in:
Miguel Jacq 2025-12-01 10:19:41 +11:00
parent 078f56a39b
commit 22b4cf4da7
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
6 changed files with 93 additions and 22 deletions

View file

@ -108,7 +108,7 @@ class MainWindow(QMainWindow):
self.search.resultDatesChanged.connect(self._on_search_dates_changed)
# Features
self.time_log = TimeLogWidget(self.db)
self.time_log = TimeLogWidget(self.db, themes=self.themes)
self.tags = PageTagsWidget(self.db)
self.tags.tagActivated.connect(self._on_tag_activated)
@ -342,7 +342,6 @@ class MainWindow(QMainWindow):
# re-apply all runtime color tweaks when theme changes
self.themes.themeChanged.connect(lambda _t: self._retheme_overrides())
self._apply_calendar_text_colors()
# apply once on startup so links / calendar colors are set immediately
self._retheme_overrides()
@ -1020,22 +1019,10 @@ class MainWindow(QMainWindow):
save_db_config(cfg)
def _retheme_overrides(self):
self._apply_calendar_text_colors()
self._apply_search_highlights(getattr(self, "_search_highlighted_dates", set()))
self.calendar.update()
self.editor.viewport().update()
def _apply_calendar_text_colors(self):
pal = QApplication.instance().palette()
txt = pal.windowText().color()
fmt = QTextCharFormat()
fmt.setForeground(txt)
# Use normal text color for weekends
self.calendar.setWeekdayTextFormat(Qt.Saturday, fmt)
self.calendar.setWeekdayTextFormat(Qt.Sunday, fmt)
# --------------- Search sidebar/results helpers ---------------- #
def _on_search_dates_changed(self, date_strs: list[str]):