mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 10:47:49 -06: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
3 changed files with 2 additions and 23 deletions
|
@ -10,7 +10,7 @@ import Cura 1.1 as Cura
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
property bool installed: toolbox.isInstalled(model.id)
|
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 bool loginRequired: model.login_required && !Cura.API.account.isLoggedIn
|
||||||
property var packageData
|
property var packageData
|
||||||
|
|
||||||
|
@ -112,11 +112,9 @@ Column
|
||||||
{
|
{
|
||||||
target: toolbox
|
target: toolbox
|
||||||
onInstallChanged: installed = toolbox.isInstalled(model.id)
|
onInstallChanged: installed = toolbox.isInstalled(model.id)
|
||||||
onMetadataChanged: canUpdate = toolbox.canUpdate(model.id)
|
|
||||||
onFilterChanged:
|
onFilterChanged:
|
||||||
{
|
{
|
||||||
installed = toolbox.isInstalled(model.id)
|
installed = toolbox.isInstalled(model.id)
|
||||||
canUpdate = toolbox.canUpdate(model.id)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import Cura 1.1 as Cura
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
property bool canUpdate: false
|
property bool canUpdate: CuraApplication.getPackageManager().packagesWithUpdate.indexOf(model.id) != -1
|
||||||
property bool canDowngrade: false
|
property bool canDowngrade: false
|
||||||
property bool loginRequired: model.login_required && !Cura.API.account.isLoggedIn
|
property bool loginRequired: model.login_required && !Cura.API.account.isLoggedIn
|
||||||
width: UM.Theme.getSize("toolbox_action_button").width
|
width: UM.Theme.getSize("toolbox_action_button").width
|
||||||
|
@ -83,7 +83,6 @@ Column
|
||||||
target: toolbox
|
target: toolbox
|
||||||
onMetadataChanged:
|
onMetadataChanged:
|
||||||
{
|
{
|
||||||
canUpdate = toolbox.canUpdate(model.id)
|
|
||||||
canDowngrade = toolbox.canDowngrade(model.id)
|
canDowngrade = toolbox.canDowngrade(model.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -461,24 +461,6 @@ class Toolbox(QObject, Extension):
|
||||||
break
|
break
|
||||||
return remote_package
|
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)
|
@pyqtSlot(str, result = bool)
|
||||||
def canDowngrade(self, package_id: str) -> 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
|
# If the currently installed version is higher than the bundled version (if present), the we can downgrade
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue