From 5552fc6e97130285696b2e732451531b237da65a Mon Sep 17 00:00:00 2001 From: Jake Probst Date: Mon, 17 Feb 2025 22:46:15 -0800 Subject: [PATCH] add hook for day rollover (#3817) * add hook for day rollover * rollover -> day_did_change --- qt/aqt/main.py | 2 ++ qt/tools/genhooks_gui.py | 1 + 2 files changed, 3 insertions(+) diff --git a/qt/aqt/main.py b/qt/aqt/main.py index cde6acbe6..e613e385f 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -554,6 +554,8 @@ class AnkiQt(QMainWindow): last_day_cutoff = self.col.sched.day_cutoff self.reviewer._refresh_needed = RefreshNeeded.QUEUES self.reviewer.refresh_if_needed() + if last_day_cutoff != current_cutoff: + gui_hooks.day_did_change() # schedule another check secs_until_cutoff = current_cutoff - int_time() diff --git a/qt/tools/genhooks_gui.py b/qt/tools/genhooks_gui.py index 57c5443cf..d0136fa3d 100644 --- a/qt/tools/genhooks_gui.py +++ b/qt/tools/genhooks_gui.py @@ -898,6 +898,7 @@ gui_hooks.webview_did_inject_style_into_page.append(mytest) `output` provides access to the unused/missing file lists and the text output that will be shown in the Check Media screen.""", ), + Hook(name="day_did_change", doc="""Called when Anki moves to the next day."""), # Importing/exporting data ################### Hook(