mirror of
https://github.com/ankitects/anki.git
synced 2026-01-05 18:13:56 -05:00
Add option to toggle add-on updates on and off
This commit is contained in:
parent
8f2144534b
commit
a657f91fe6
5 changed files with 32 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -95,6 +95,19 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="check_for_addon_updates">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>preferences_check_for_addon_updates</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
@ -1254,6 +1267,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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue