don't show routine update when not update_enabled

This commit is contained in:
bluegreenmagick 2021-03-09 22:27:28 +09:00
parent 29076ec9ec
commit 4cde93ed74
2 changed files with 17 additions and 3 deletions

View File

@ -1325,9 +1325,10 @@ def check_and_prompt_for_updates(
parent: QWidget, parent: QWidget,
mgr: AddonManager, mgr: AddonManager,
on_done: Callable[[List[DownloadLogEntry]], None], on_done: Callable[[List[DownloadLogEntry]], None],
requested_by_user: bool = True,
) -> None: ) -> None:
def on_updates_received(client: HttpClient, items: List[Dict]) -> 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) check_for_updates(mgr, on_updates_received)
@ -1396,6 +1397,7 @@ def handle_update_info(
client: HttpClient, client: HttpClient,
items: List[Dict], items: List[Dict],
on_done: Callable[[List[DownloadLogEntry]], None], on_done: Callable[[List[DownloadLogEntry]], None],
requested_by_user: bool = True,
) -> None: ) -> None:
update_info = mgr.extract_update_info(items) update_info = mgr.extract_update_info(items)
mgr.update_supported_versions(update_info) mgr.update_supported_versions(update_info)
@ -1406,7 +1408,7 @@ def handle_update_info(
on_done([]) on_done([])
return 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( def prompt_to_update(
@ -1415,7 +1417,16 @@ def prompt_to_update(
client: HttpClient, client: HttpClient,
updated_addons: List[UpdateInfo], updated_addons: List[UpdateInfo],
on_done: Callable[[List[DownloadLogEntry]], None], on_done: Callable[[List[DownloadLogEntry]], None],
requested_by_user: bool = True,
) -> None: ) -> 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() ids = ChooseAddonsToUpdateDialog(parent, mgr, updated_addons).ask()
if not ids: if not ids:
return return

View File

@ -848,7 +848,10 @@ title="%s" %s>%s</button>""" % (
if elap > 86_400: if elap > 86_400:
check_and_prompt_for_updates( 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()) self.pm.set_last_addon_update_check(intTime())