From a657f91fe6d0a5e8af24248501267ce897dcc76c Mon Sep 17 00:00:00 2001 From: SecretX33 <4389757+SecretX33@users.noreply.github.com> Date: Sat, 27 Dec 2025 10:50:44 -0300 Subject: [PATCH 1/6] Add option to toggle add-on updates on and off --- ftl/core/preferences.ftl | 1 + qt/aqt/forms/preferences.ui | 14 ++++++++++++++ qt/aqt/main.py | 5 +++++ qt/aqt/preferences.py | 6 ++++++ qt/aqt/profiles.py | 6 ++++++ 5 files changed, 32 insertions(+) diff --git a/ftl/core/preferences.ftl b/ftl/core/preferences.ftl index 23b72f267..f2adc15b1 100644 --- a/ftl/core/preferences.ftl +++ b/ftl/core/preferences.ftl @@ -41,6 +41,7 @@ preferences-theme-light = Light preferences-theme-dark = Dark preferences-v3-scheduler = V3 scheduler preferences-check-for-updates = Check for program updates +preferences-check-for-addon-updates = Check for add-on updates preferences-ignore-accents-in-search = Ignore accents in search (slower) preferences-backup-explanation = Anki periodically backs up your collection. After backups are more than 2 days old, diff --git a/qt/aqt/forms/preferences.ui b/qt/aqt/forms/preferences.ui index 0035e1f42..9f71b23e8 100644 --- a/qt/aqt/forms/preferences.ui +++ b/qt/aqt/forms/preferences.ui @@ -95,6 +95,19 @@ + + + + + 0 + 0 + + + + preferences_check_for_addon_updates + + + @@ -1254,6 +1267,7 @@ lang video_driver check_for_updates + check_for_addon_updates theme styleComboBox uiScale diff --git a/qt/aqt/main.py b/qt/aqt/main.py index c707d1b2a..3a320d386 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1022,6 +1022,11 @@ title="{}" {}>{}""".format( def maybe_check_for_addon_updates( self, on_done: Callable[[list[DownloadLogEntry]], None] | None = None ) -> None: + if not self.pm.check_for_addon_updates(): + if on_done: + on_done([]) + return + last_check = self.pm.last_addon_update_check() elap = int_time() - last_check diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 939dd8c2c..17664586b 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -224,6 +224,12 @@ class Preferences(QDialog): self.form.check_for_updates.setChecked(self.mw.pm.check_for_updates()) qconnect(self.form.check_for_updates.stateChanged, self.mw.pm.set_update_check) + self.form.check_for_addon_updates.setChecked(self.mw.pm.check_for_addon_updates()) + qconnect( + self.form.check_for_addon_updates.stateChanged, + self.mw.pm.set_check_for_addon_updates, + ) + self.update_login_status() qconnect(self.form.syncLogout.clicked, self.sync_logout) qconnect(self.form.syncLogin.clicked, self.sync_login) diff --git a/qt/aqt/profiles.py b/qt/aqt/profiles.py index 919be170c..15587467d 100644 --- a/qt/aqt/profiles.py +++ b/qt/aqt/profiles.py @@ -596,6 +596,12 @@ create table if not exists profiles def set_last_addon_update_check(self, secs: int) -> None: self.meta["last_addon_update_check"] = secs + def check_for_addon_updates(self) -> bool: + return self.meta.get("check_for_addon_updates", True) + + def set_check_for_addon_updates(self, on: bool) -> None: + self.meta["check_for_addon_updates"] = on + @deprecated(info="use theme_manager.night_mode") def night_mode(self) -> bool: return theme_manager.night_mode From 7dd4128d5652e55048a3cde4b770f8112d708589 Mon Sep 17 00:00:00 2001 From: SecretX33 <4389757+SecretX33@users.noreply.github.com> Date: Sat, 27 Dec 2025 11:01:48 -0300 Subject: [PATCH 2/6] Group both update options into their own subsection --- ftl/core/preferences.ftl | 1 + qt/aqt/forms/preferences.ui | 25 +++++++++++-------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/ftl/core/preferences.ftl b/ftl/core/preferences.ftl index f2adc15b1..e7c237849 100644 --- a/ftl/core/preferences.ftl +++ b/ftl/core/preferences.ftl @@ -40,6 +40,7 @@ preferences-theme-follow-system = Follow System preferences-theme-light = Light preferences-theme-dark = Dark preferences-v3-scheduler = V3 scheduler +preferences-updates = Updates preferences-check-for-updates = Check for program updates preferences-check-for-addon-updates = Check for add-on updates preferences-ignore-accents-in-search = Ignore accents in search (slower) diff --git a/qt/aqt/forms/preferences.ui b/qt/aqt/forms/preferences.ui index 9f71b23e8..67cd67a5f 100644 --- a/qt/aqt/forms/preferences.ui +++ b/qt/aqt/forms/preferences.ui @@ -82,27 +82,24 @@ - + + + + + + + preferences_updates + + + - - - 0 - 0 - - preferences_check_for_updates - + - - - 0 - 0 - - preferences_check_for_addon_updates From 0a82f607c9689225f3110e3fe80ebc2598753513 Mon Sep 17 00:00:00 2001 From: SecretX33 <4389757+SecretX33@users.noreply.github.com> Date: Sat, 27 Dec 2025 11:09:43 -0300 Subject: [PATCH 3/6] Add "Check for Updates" action to manually check for updates --- ftl/qt/qt-accel.ftl | 1 + qt/aqt/forms/main.ui | 6 ++++++ qt/aqt/main.py | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/ftl/qt/qt-accel.ftl b/ftl/qt/qt-accel.ftl index 3ab54eb24..22c315aec 100644 --- a/ftl/qt/qt-accel.ftl +++ b/ftl/qt/qt-accel.ftl @@ -3,6 +3,7 @@ qt-accel-about-mac = About Anki... qt-accel-cards = &Cards qt-accel-check-database = &Check Database qt-accel-check-media = Check &Media +qt-accel-check-for-updates = Check for &Updates... qt-accel-edit = &Edit qt-accel-exit = E&xit qt-accel-export = &Export... diff --git a/qt/aqt/forms/main.ui b/qt/aqt/forms/main.ui index bffc67ad0..54eab80aa 100644 --- a/qt/aqt/forms/main.ui +++ b/qt/aqt/forms/main.ui @@ -55,6 +55,7 @@ + @@ -179,6 +180,11 @@ F1 + + + qt_accel_check_for_updates + + qt_accel_switch_profile diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 3a320d386..873935fc4 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1332,6 +1332,11 @@ title="{}" {}>{}""".format( def onDocumentation(self) -> None: openHelp(HelpPage.INDEX) + def onCheckForUpdates(self) -> None: + from aqt.update import check_for_update + + check_for_update() + # legacy def onDeckConf(self, deck: DeckDict | None = None) -> None: @@ -1415,6 +1420,7 @@ title="{}" {}>{}""".format( # Help qconnect(m.actionDocumentation.triggered, self.onDocumentation) + qconnect(m.actionCheckForUpdates.triggered, self.onCheckForUpdates) qconnect(m.actionDonate.triggered, self.onDonate) qconnect(m.actionAbout.triggered, self.onAbout) m.actionAbout.setText(tr.qt_accel_about_mac()) From 2d19aa749c57c4df984743caf16011c44c6c48a6 Mon Sep 17 00:00:00 2001 From: SecretX33 <4389757+SecretX33@users.noreply.github.com> Date: Sat, 27 Dec 2025 11:17:49 -0300 Subject: [PATCH 4/6] Display a dialog box message saying that there's no update when manually checking --- ftl/qt/qt-misc.ftl | 1 + qt/aqt/main.py | 2 +- qt/aqt/update.py | 9 +++++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ftl/qt/qt-misc.ftl b/ftl/qt/qt-misc.ftl index d7bbef990..5dbbd787c 100644 --- a/ftl/qt/qt-misc.ftl +++ b/ftl/qt/qt-misc.ftl @@ -3,6 +3,7 @@ qt-misc-addons = Add-ons qt-misc-all-cards-notes-and-media-for = All cards, notes, and media for this profile will be deleted. Are you sure? qt-misc-all-cards-notes-and-media-for2 = All cards, notes, and media for the profile "{ $name }" will be deleted. Are you sure? qt-misc-anki-updatedanki-has-been-released =

Anki Updated

Anki { $val } has been released.

+qt-misc-no-update-available = You're up to date!

Anki { $val } is currently the newest version available. qt-misc-automatic-syncing-and-backups-have-been = Backup successfully restored. Automatic syncing and backups have been disabled for now. To enable them again, close the profile or restart Anki. qt-misc-back-side-only = Back Side Only qt-misc-backing-up = Backing Up... diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 873935fc4..df7566242 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1335,7 +1335,7 @@ title="{}" {}>{}""".format( def onCheckForUpdates(self) -> None: from aqt.update import check_for_update - check_for_update() + check_for_update(notify_if_no_update=True) # legacy diff --git a/qt/aqt/update.py b/qt/aqt/update.py index e5794eead..f70d8aea3 100644 --- a/qt/aqt/update.py +++ b/qt/aqt/update.py @@ -15,10 +15,10 @@ from aqt.package import ( update_and_restart as _update_and_restart, ) from aqt.qt import * -from aqt.utils import openLink, show_warning, showText, tr +from aqt.utils import openLink, show_info, show_warning, showText, tr -def check_for_update() -> None: +def check_for_update(notify_if_no_update: bool = False) -> None: from aqt import mw def do_check(_col: Collection) -> CheckForUpdateResponse: @@ -54,6 +54,11 @@ def check_for_update() -> None: if ver := resp.new_version: if mw.pm.meta.get("suppressUpdate", None) != ver: prompt_to_update(mw, ver) + elif notify_if_no_update: + show_info( + tr.qt_misc_no_update_available(val=aqt.appVersion), + textFormat=Qt.TextFormat.RichText, + ) def on_fail(exc: Exception) -> None: print(f"update check failed: {exc}") From 85f976c4660af495b9f883ee9290f0534e3396fe Mon Sep 17 00:00:00 2001 From: SecretX <4389757+SecretX33@users.noreply.github.com> Date: Sat, 27 Dec 2025 12:27:19 -0300 Subject: [PATCH 5/6] Add SecretX to CONTRIBUTORS list --- CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index a874a313d..2aaa800f4 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -256,6 +256,7 @@ Eltaurus jariji Francisco Esteva SelfishPig +SecretX ******************** From 8b963b9ad696d5244bbae1ced2d3b1b573f99970 Mon Sep 17 00:00:00 2001 From: SecretX33 <4389757+SecretX33@users.noreply.github.com> Date: Sun, 28 Dec 2025 00:11:42 -0300 Subject: [PATCH 6/6] Remove 'check for updates' option from Help menu --- ftl/qt/qt-accel.ftl | 1 - ftl/qt/qt-misc.ftl | 1 - qt/aqt/forms/main.ui | 6 ------ qt/aqt/main.py | 6 ------ qt/aqt/update.py | 9 ++------- 5 files changed, 2 insertions(+), 21 deletions(-) diff --git a/ftl/qt/qt-accel.ftl b/ftl/qt/qt-accel.ftl index 22c315aec..3ab54eb24 100644 --- a/ftl/qt/qt-accel.ftl +++ b/ftl/qt/qt-accel.ftl @@ -3,7 +3,6 @@ qt-accel-about-mac = About Anki... qt-accel-cards = &Cards qt-accel-check-database = &Check Database qt-accel-check-media = Check &Media -qt-accel-check-for-updates = Check for &Updates... qt-accel-edit = &Edit qt-accel-exit = E&xit qt-accel-export = &Export... diff --git a/ftl/qt/qt-misc.ftl b/ftl/qt/qt-misc.ftl index 5dbbd787c..d7bbef990 100644 --- a/ftl/qt/qt-misc.ftl +++ b/ftl/qt/qt-misc.ftl @@ -3,7 +3,6 @@ qt-misc-addons = Add-ons qt-misc-all-cards-notes-and-media-for = All cards, notes, and media for this profile will be deleted. Are you sure? qt-misc-all-cards-notes-and-media-for2 = All cards, notes, and media for the profile "{ $name }" will be deleted. Are you sure? qt-misc-anki-updatedanki-has-been-released =

Anki Updated

Anki { $val } has been released.

-qt-misc-no-update-available = You're up to date!

Anki { $val } is currently the newest version available. qt-misc-automatic-syncing-and-backups-have-been = Backup successfully restored. Automatic syncing and backups have been disabled for now. To enable them again, close the profile or restart Anki. qt-misc-back-side-only = Back Side Only qt-misc-backing-up = Backing Up... diff --git a/qt/aqt/forms/main.ui b/qt/aqt/forms/main.ui index 54eab80aa..bffc67ad0 100644 --- a/qt/aqt/forms/main.ui +++ b/qt/aqt/forms/main.ui @@ -55,7 +55,6 @@
-
@@ -180,11 +179,6 @@ F1 - - - qt_accel_check_for_updates - - qt_accel_switch_profile diff --git a/qt/aqt/main.py b/qt/aqt/main.py index df7566242..3a320d386 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -1332,11 +1332,6 @@ title="{}" {}>{}""".format( def onDocumentation(self) -> None: openHelp(HelpPage.INDEX) - def onCheckForUpdates(self) -> None: - from aqt.update import check_for_update - - check_for_update(notify_if_no_update=True) - # legacy def onDeckConf(self, deck: DeckDict | None = None) -> None: @@ -1420,7 +1415,6 @@ title="{}" {}>{}""".format( # Help qconnect(m.actionDocumentation.triggered, self.onDocumentation) - qconnect(m.actionCheckForUpdates.triggered, self.onCheckForUpdates) qconnect(m.actionDonate.triggered, self.onDonate) qconnect(m.actionAbout.triggered, self.onAbout) m.actionAbout.setText(tr.qt_accel_about_mac()) diff --git a/qt/aqt/update.py b/qt/aqt/update.py index f70d8aea3..e5794eead 100644 --- a/qt/aqt/update.py +++ b/qt/aqt/update.py @@ -15,10 +15,10 @@ from aqt.package import ( update_and_restart as _update_and_restart, ) from aqt.qt import * -from aqt.utils import openLink, show_info, show_warning, showText, tr +from aqt.utils import openLink, show_warning, showText, tr -def check_for_update(notify_if_no_update: bool = False) -> None: +def check_for_update() -> None: from aqt import mw def do_check(_col: Collection) -> CheckForUpdateResponse: @@ -54,11 +54,6 @@ def check_for_update(notify_if_no_update: bool = False) -> None: if ver := resp.new_version: if mw.pm.meta.get("suppressUpdate", None) != ver: prompt_to_update(mw, ver) - elif notify_if_no_update: - show_info( - tr.qt_misc_no_update_available(val=aqt.appVersion), - textFormat=Qt.TextFormat.RichText, - ) def on_fail(exc: Exception) -> None: print(f"update check failed: {exc}")