This commit is contained in:
SecretX 2025-12-28 03:19:21 +00:00 committed by GitHub
commit 5d91e2ad9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 38 additions and 7 deletions

View file

@ -256,6 +256,7 @@ Eltaurus <https://github.com/Eltaurus-Lt>
jariji
Francisco Esteva <fr.esteva@duocuc.cl>
SelfishPig <https://github.com/SelfishPig>
SecretX <https://github.com/SecretX33>
********************

View file

@ -40,7 +40,9 @@ 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)
preferences-backup-explanation =
Anki periodically backs up your collection. After backups are more than 2 days old,

View file

@ -82,19 +82,29 @@
</property>
</widget>
</item>
<item row="2" column="0">
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="updatesGroup">
<property name="title">
<string>preferences_updates</string>
</property>
<layout class="QVBoxLayout" name="updatesLayout">
<item>
<widget class="QCheckBox" name="check_for_updates">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>preferences_check_for_updates</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="check_for_addon_updates">
<property name="text">
<string>preferences_check_for_addon_updates</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -1254,6 +1264,7 @@
<tabstop>lang</tabstop>
<tabstop>video_driver</tabstop>
<tabstop>check_for_updates</tabstop>
<tabstop>check_for_addon_updates</tabstop>
<tabstop>theme</tabstop>
<tabstop>styleComboBox</tabstop>
<tabstop>uiScale</tabstop>

View file

@ -1022,6 +1022,11 @@ title="{}" {}>{}</button>""".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

View file

@ -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)

View file

@ -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