mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-28 23:04:34 +08:00
Remove usage of canUpdate slot
This makes it a bit cleaner, since having it as a slot is a bit weird in the first place (and forced all kinds of hacks to ensure it got re-evaluated) CURA-6151
This commit is contained in:
parent
f4f94b10d2
commit
e3f2c06542
@ -10,7 +10,7 @@ import Cura 1.1 as Cura
|
||||
Column
|
||||
{
|
||||
property bool installed: toolbox.isInstalled(model.id)
|
||||
property bool canUpdate: toolbox.canUpdate(model.id)
|
||||
property bool canUpdate: CuraApplication.getPackageManager().packagesWithUpdate.indexOf(model.id) != -1
|
||||
property bool loginRequired: model.login_required && !Cura.API.account.isLoggedIn
|
||||
property var packageData
|
||||
|
||||
@ -112,11 +112,9 @@ Column
|
||||
{
|
||||
target: toolbox
|
||||
onInstallChanged: installed = toolbox.isInstalled(model.id)
|
||||
onMetadataChanged: canUpdate = toolbox.canUpdate(model.id)
|
||||
onFilterChanged:
|
||||
{
|
||||
installed = toolbox.isInstalled(model.id)
|
||||
canUpdate = toolbox.canUpdate(model.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import Cura 1.1 as Cura
|
||||
|
||||
Column
|
||||
{
|
||||
property bool canUpdate: false
|
||||
property bool canUpdate: CuraApplication.getPackageManager().packagesWithUpdate.indexOf(model.id) != -1
|
||||
property bool canDowngrade: false
|
||||
property bool loginRequired: model.login_required && !Cura.API.account.isLoggedIn
|
||||
width: UM.Theme.getSize("toolbox_action_button").width
|
||||
@ -83,7 +83,6 @@ Column
|
||||
target: toolbox
|
||||
onMetadataChanged:
|
||||
{
|
||||
canUpdate = toolbox.canUpdate(model.id)
|
||||
canDowngrade = toolbox.canDowngrade(model.id)
|
||||
}
|
||||
}
|
||||
|
@ -461,24 +461,6 @@ class Toolbox(QObject, Extension):
|
||||
break
|
||||
return remote_package
|
||||
|
||||
# Give a list of package ids that have an update available.
|
||||
@pyqtProperty(bool, notify=metadataChanged)
|
||||
def packagesWithUpdateAvailable(self) -> List[str]:
|
||||
all_installed_packages = self._package_manager.getAllInstalledPackageIDs()
|
||||
|
||||
packages_with_update_available = []
|
||||
for package_id in all_installed_packages:
|
||||
if self.canUpdate(package_id):
|
||||
packages_with_update_available.append(package_id)
|
||||
|
||||
return packages_with_update_available
|
||||
|
||||
# Checks
|
||||
# --------------------------------------------------------------------------
|
||||
@pyqtSlot(str, result = bool)
|
||||
def canUpdate(self, package_id: str) -> bool:
|
||||
return package_id in self._package_manager.packagesWithUpdate
|
||||
|
||||
@pyqtSlot(str, result = bool)
|
||||
def canDowngrade(self, package_id: str) -> bool:
|
||||
# If the currently installed version is higher than the bundled version (if present), the we can downgrade
|
||||
|
Loading…
x
Reference in New Issue
Block a user