diff --git a/bouquin/main_window.py b/bouquin/main_window.py index 394ccb9..5b8bc97 100644 --- a/bouquin/main_window.py +++ b/bouquin/main_window.py @@ -97,6 +97,13 @@ class MainWindow(QMainWindow): nav_menu.addAction(act_next) self.addAction(act_next) + act_today = QAction("Today", self) + act_today.setShortcut("Ctrl+T") + act_today.setShortcutContext(Qt.ApplicationShortcut) + act_today.triggered.connect(self._adjust_today) + nav_menu.addAction(act_today) + self.addAction(act_today) + # Autosave self._dirty = False self._save_timer = QTimer(self) @@ -176,6 +183,11 @@ class MainWindow(QMainWindow): d = self.calendar.selectedDate().addDays(delta) self.calendar.setSelectedDate(d) + def _adjust_today(self): + """Jump to today.""" + today = QDate.currentDate() + self.calendar.setSelectedDate(today) + def _on_date_changed(self): """ When the calendar selection changes, save the previous day's note if dirty,