Addon Manager: Improve manual update display

This commit is contained in:
Chris Hennes
2022-02-17 19:00:57 -06:00
parent cbb93da3ff
commit a3e310ab55

View File

@@ -372,7 +372,7 @@ class CommandAddonManager:
self.dialog.buttonClose.clicked.connect(self.dialog.reject)
self.dialog.buttonUpdateCache.clicked.connect(self.on_buttonUpdateCache_clicked)
self.dialog.buttonPauseUpdate.clicked.connect(self.stop_update)
self.dialog.buttonCheckForUpdates.clicked.connect(self.force_check_updates)
self.dialog.buttonCheckForUpdates.clicked.connect(lambda: self.force_check_updates(standalone=True))
self.packageList.itemSelected.connect(self.table_row_activated)
self.packageList.setEnabled(False)
self.packageDetails.execute.connect(self.executemacro)
@@ -735,22 +735,29 @@ class CommandAddonManager:
self.do_next_startup_phase()
return
if not self.packages_with_updates:
self.force_check_updates()
self.do_next_startup_phase()
self.force_check_updates(standalone = False)
else:
self.do_next_startup_phase()
def force_check_updates(self) -> None:
def force_check_updates(self, standalone = False) -> None:
if hasattr(self, "check_worker"):
thread = self.check_worker
if thread:
if not thread.isFinished():
self.do_next_startup_phase()
return
self.dialog.buttonUpdateAll.setText(
translate("AddonsInstaller", "Checking for updates...")
)
self.check_worker = CheckWorkbenchesForUpdatesWorker(self.item_model.repos)
self.dialog.buttonUpdateAll.show()
self.check_worker = CheckWorkbenchesForUpdatesWorker(self.item_model.repos)
self.check_worker.finished.connect(self.do_next_startup_phase)
self.check_worker.finished.connect(self.update_check_complete)
self.check_worker.progress_made.connect(self.update_progress_bar)
if standalone:
self.current_progress_region = 1
self.number_of_progress_regions = 1
self.check_worker.update_status.connect(self.status_updated)
self.check_worker.start()
self.enable_updates(len(self.packages_with_updates))
@@ -772,12 +779,19 @@ class CommandAddonManager:
)
self.dialog.buttonUpdateAll.setText(s.format(number_of_updates))
self.dialog.buttonUpdateAll.setEnabled(True)
elif hasattr(self, "check_worker") and self.check_worker.isRunning():
self.dialog.buttonUpdateAll.setText(
translate("AddonsInstaller", "Checking for updates...")
)
else:
self.dialog.buttonUpdateAll.setText(
translate("AddonsInstaller", "No updates available")
)
self.dialog.buttonUpdateAll.setEnabled(False)
def update_check_complete(self) -> None:
self.enable_updates(len(self.packages_with_updates))
def add_addon_repo(self, addon_repo: AddonManagerRepo) -> None:
"""adds a workbench to the list"""