diff options
author | Jelle Spijker <spijker.jelle@gmail.com> | 2021-12-10 14:39:44 +0300 |
---|---|---|
committer | Jelle Spijker <spijker.jelle@gmail.com> | 2021-12-10 14:39:44 +0300 |
commit | a571e875530746c4b728312f0fae07a1c673a7a7 (patch) | |
tree | 16525f17637addc6db38e203ad09e5294d3d5d2f | |
parent | 9b7731a21be9d11dbe0df4243fdb160df7376d12 (diff) |
Fixed the spinner
Contributes to CURA-8587
-rw-r--r-- | plugins/Marketplace/PackageModel.py | 17 | ||||
-rw-r--r-- | plugins/Marketplace/resources/qml/ManageButton.qml | 2 | ||||
-rw-r--r-- | plugins/Marketplace/resources/qml/PackageCardHeader.qml | 4 |
3 files changed, 15 insertions, 8 deletions
diff --git a/plugins/Marketplace/PackageModel.py b/plugins/Marketplace/PackageModel.py index e2d785606d..6a7c943e2c 100644 --- a/plugins/Marketplace/PackageModel.py +++ b/plugins/Marketplace/PackageModel.py @@ -64,23 +64,30 @@ class PackageModel(QObject): self._icon_url = author_data.get("icon_url", "") self._is_installing = False + self._recently_installed = False self._install_status_changing = False self._can_update = False self._is_updating = False + self._recently_updated = False self._section_title = section_title self.sdk_version = package_data.get("sdk_version_semver", "") # Note that there's a lot more info in the package_data than just these specified here. self.enablePackageTriggered.connect(self._plugin_registry.enablePlugin) self.disablePackageTriggered.connect(self._plugin_registry.disablePlugin) - self.installPackageTriggered.connect(lambda pkg_id: self.setIsInstalling(True)) + self.installPackageTriggered.connect(lambda pkg_id, url: self.setIsInstalling(True)) self.uninstallPackageTriggered.connect(lambda pkg_id: self.setIsInstalling(True)) self.updatePackageTriggered.connect(lambda pkg_id: self.setIsUpdating(True)) def finished_installed(): - self.setIsUpdating(False) - self.setIsInstalling(False) + if self.isInstalling: + self._recently_installed = True + self.setIsInstalling(False) + if self.isUpdating: + self._recently_updated = True + self._can_update = not self._package_id in self._package_manager.getPackagesToInstall() + self.setIsUpdating(False) self._package_manager.installedPackagesChanged.connect(finished_installed) self._plugin_registry.hasPluginsEnabledOrDisabledChanged.connect(self.stateManageButtonChanged) @@ -324,7 +331,7 @@ class PackageModel(QObject): @pyqtProperty(bool, notify = stateManageButtonChanged) def isRecentlyInstalled(self) -> bool: - return self._package_id in self._package_manager.getPackagesToInstall() + return self._recently_installed and self._package_id in self._package_manager.getPackagesToInstall() @pyqtProperty(bool, notify = stateManageButtonChanged) def isRecentlyUninstalled(self) -> bool: @@ -346,7 +353,7 @@ class PackageModel(QObject): @pyqtProperty(bool, notify = stateManageButtonChanged) def isRecentlyUpdated(self): - return self._package_id in self._package_manager.getPackagesToInstall() and self._package_id in self._package_manager.getPackagesToRemove() + return self._recently_updated and self._package_id in self._package_manager.getPackagesToInstall() def setCanUpdate(self, value: bool) -> None: if value != self._can_update: diff --git a/plugins/Marketplace/resources/qml/ManageButton.qml b/plugins/Marketplace/resources/qml/ManageButton.qml index 2c05af02e9..ac7577b543 100644 --- a/plugins/Marketplace/resources/qml/ManageButton.qml +++ b/plugins/Marketplace/resources/qml/ManageButton.qml @@ -61,7 +61,7 @@ Item RotationAnimator { target: busyIndicator - running: busyMessage.visible + running: parent.visible from: 0 to: 360 loops: Animation.Infinite diff --git a/plugins/Marketplace/resources/qml/PackageCardHeader.qml b/plugins/Marketplace/resources/qml/PackageCardHeader.qml index ec33505391..56cfe4fa61 100644 --- a/plugins/Marketplace/resources/qml/PackageCardHeader.qml +++ b/plugins/Marketplace/resources/qml/PackageCardHeader.qml @@ -242,7 +242,7 @@ Item { if (primary_action) { - packageData.installPackageTriggered(packageData.packageId) + packageData.installPackageTriggered(packageData.packageId, packageData.downloadURL) } else { @@ -270,7 +270,7 @@ Item else { return catalog.i18nc("@button", "Update"); } } - onClicked: packageData.updatePackageTriggered(packageData.packageId, packageData.downloadURL) + onClicked: packageData.updatePackageTriggered(packageData.packageId) } } } |