Show the uninstall button for packages which can be downgraded to the bundled version

Contributes to: CURA-8587
This commit is contained in:
Jelle Spijker 2021-12-06 14:11:31 +01:00
parent 28b6bfb729
commit 1cc3d374a0
No known key found for this signature in database
GPG key ID: 6662DC033BE6B99A
2 changed files with 16 additions and 3 deletions

View file

@ -66,6 +66,7 @@ class PackageModel(QObject):
self._can_update = False
self._is_updating = False
self._is_enabling = False
self._can_downgrade = 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.
@ -323,7 +324,7 @@ class PackageModel(QObject):
if self._is_recently_managed:
return "hidden"
if self._is_installed:
if self._is_bundled:
if self._is_bundled and not self._can_downgrade:
return "hidden"
else:
return "secondary"
@ -350,6 +351,16 @@ class PackageModel(QObject):
self._is_installing = value
self.stateManageButtonChanged.emit()
@property
def can_downgrade(self) -> bool:
return self._can_downgrade
@can_downgrade.setter
def can_downgrade(self, value: bool) -> None:
if value != self._can_downgrade:
self._can_downgrade = value
self.stateManageButtonChanged.emit()
# --- Updating ---
@pyqtProperty(str, notify = stateManageButtonChanged)