Add Install Pending Updates button to Account popup

CURA-7473
This commit is contained in:
Nino van Hooff 2020-06-26 11:37:01 +02:00
parent f35ca0eb7d
commit 4f1a18f102
3 changed files with 64 additions and 12 deletions

View file

@ -95,10 +95,6 @@ class CloudPackageChecker(QObject):
user_subscribed_packages = {plugin["package_id"] for plugin in subscribed_packages_payload}
user_installed_packages = self._package_manager.getAllInstalledPackageIDs()
if user_subscribed_packages == self._last_notified_packages:
# already notified user about these
return
# We need to re-evaluate the dismissed packages
# (i.e. some package might got updated to the correct SDK version in the meantime,
# hence remove them from the Dismissed Incompatible list)
@ -109,7 +105,15 @@ class CloudPackageChecker(QObject):
# We check if there are packages installed in Web Marketplace but not in Cura marketplace
package_discrepancy = list(user_subscribed_packages.difference(user_installed_packages))
if package_discrepancy:
account = self._application.getCuraAPI().account
account.setUpdatePackagesAction(lambda: self._onSyncButtonClicked(None, None))
if user_subscribed_packages == self._last_notified_packages:
# already notified user about these
return
Logger.log("d", "Discrepancy found between Cloud subscribed packages and Cura installed packages")
self._model.addDiscrepancies(package_discrepancy)
self._model.initialize(self._package_manager, subscribed_packages_payload)
@ -144,7 +148,8 @@ class CloudPackageChecker(QObject):
self._message.hide()
self._message = None
def _onSyncButtonClicked(self, sync_message: Message, sync_message_action: str) -> None:
sync_message.hide()
def _onSyncButtonClicked(self, sync_message: Optional[Message], sync_message_action: Optional[str]) -> None:
if sync_message is not None:
sync_message.hide()
self._hideSyncMessage() # Should be the same message, but also sets _message to None
self.discrepancies.emit(self._model)