From 4cde93ed747db2badcf60827adfca625e0d3a05d Mon Sep 17 00:00:00 2001 From: bluegreenmagick Date: Tue, 9 Mar 2021 22:27:28 +0900 Subject: [PATCH] don't show routine update when not update_enabled --- qt/aqt/addons.py | 15 +++++++++++++-- qt/aqt/main.py | 5 ++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/qt/aqt/addons.py b/qt/aqt/addons.py index 0459df6eb..e50ac35db 100644 --- a/qt/aqt/addons.py +++ b/qt/aqt/addons.py @@ -1325,9 +1325,10 @@ def check_and_prompt_for_updates( parent: QWidget, mgr: AddonManager, on_done: Callable[[List[DownloadLogEntry]], None], + requested_by_user: bool = True, ) -> None: def on_updates_received(client: HttpClient, items: List[Dict]) -> None: - handle_update_info(parent, mgr, client, items, on_done) + handle_update_info(parent, mgr, client, items, on_done, requested_by_user) check_for_updates(mgr, on_updates_received) @@ -1396,6 +1397,7 @@ def handle_update_info( client: HttpClient, items: List[Dict], on_done: Callable[[List[DownloadLogEntry]], None], + requested_by_user: bool = True, ) -> None: update_info = mgr.extract_update_info(items) mgr.update_supported_versions(update_info) @@ -1406,7 +1408,7 @@ def handle_update_info( on_done([]) return - prompt_to_update(parent, mgr, client, updated_addons, on_done) + prompt_to_update(parent, mgr, client, updated_addons, on_done, requested_by_user) def prompt_to_update( @@ -1415,7 +1417,16 @@ def prompt_to_update( client: HttpClient, updated_addons: List[UpdateInfo], on_done: Callable[[List[DownloadLogEntry]], None], + requested_by_user: bool = True, ) -> None: + if not requested_by_user: + prompt_update = False + for addon in updated_addons: + if mgr.addon_meta(str(addon.id)).update_enabled: + prompt_update = True + if not prompt_update: + return + ids = ChooseAddonsToUpdateDialog(parent, mgr, updated_addons).ask() if not ids: return diff --git a/qt/aqt/main.py b/qt/aqt/main.py index 00217ff82..bf3b5d49d 100644 --- a/qt/aqt/main.py +++ b/qt/aqt/main.py @@ -848,7 +848,10 @@ title="%s" %s>%s""" % ( if elap > 86_400: check_and_prompt_for_updates( - self, self.addonManager, self.on_updates_installed + self, + self.addonManager, + self.on_updates_installed, + requested_by_user=False, ) self.pm.set_last_addon_update_check(intTime())