mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Fixed update buttons
Contributes to: CURA-8587
This commit is contained in:
parent
8dc88e52c2
commit
0299bb1694
3 changed files with 10 additions and 11 deletions
|
@ -51,7 +51,7 @@ class LocalPackageList(PackageList):
|
|||
|
||||
# Obtain and sort the local packages
|
||||
self.setItems([{"package": p} for p in [self._makePackageModel(p) for p in self._manager.local_packages]])
|
||||
self.sort(attrgetter("sectionTitle", "can_update", "displayName"), key = "package", reverse = True)
|
||||
self.sort(attrgetter("sectionTitle", "_can_update", "displayName"), key = "package", reverse = True)
|
||||
self.checkForUpdates(self._manager.local_packages)
|
||||
|
||||
self.setIsLoading(False)
|
||||
|
@ -97,9 +97,9 @@ class LocalPackageList(PackageList):
|
|||
for package_data in response_data["data"]:
|
||||
package = self.getPackageModel(package_data["package_id"])
|
||||
package.download_url = package_data.get("download_url", "")
|
||||
package.can_update = True
|
||||
package.setCanUpdate(True)
|
||||
|
||||
self.sort(attrgetter("sectionTitle", "can_update", "displayName"), key = "package", reverse = True)
|
||||
self.sort(attrgetter("sectionTitle", "_can_update", "displayName"), key = "package", reverse = True)
|
||||
self._ongoing_requests["check_updates"] = None
|
||||
except RuntimeError:
|
||||
# Setting the ownership of this object to not qml can still result in a RuntimeError. Which can occur when quickly toggling
|
||||
|
|
|
@ -368,13 +368,12 @@ class PackageModel(QObject):
|
|||
def isRecentlyUpdated(self):
|
||||
return self._package_id in self._package_manager.getPackagesToInstall() and self._package_id in self._package_manager.getPackagesToRemove()
|
||||
|
||||
@property
|
||||
def can_update(self) -> bool:
|
||||
"""Flag indicating if the package can be updated"""
|
||||
return self._can_update
|
||||
|
||||
@can_update.setter
|
||||
def can_update(self, value: bool) -> None:
|
||||
def setCanUpdate(self, value: bool) -> None:
|
||||
if value != self._can_update:
|
||||
self._can_update = value
|
||||
self.stateManageButtonChanged.emit()
|
||||
|
||||
@pyqtProperty(bool, fset = setCanUpdate, notify = stateManageButtonChanged)
|
||||
def canUpdate(self) -> bool:
|
||||
"""Flag indicating if the package can be updated"""
|
||||
return self._can_update
|
||||
|
|
|
@ -250,7 +250,7 @@ Item
|
|||
ManageButton
|
||||
{
|
||||
id: updateManageButton
|
||||
visible: (showManageButtons && confirmed) && !installManageButton.confirmed
|
||||
visible: (showManageButtons || confirmed) && packageData.canUpdate && !installManageButton.confirmed
|
||||
enabled: !installManageButton.busy
|
||||
|
||||
busy: packageData.isUpdating
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue