mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Handle bundled packages which can be Downgraded
Contributes to: CURA-8587
This commit is contained in:
parent
8a583a4323
commit
4c5ca22b24
3 changed files with 7 additions and 12 deletions
|
@ -66,7 +66,6 @@ class LocalPackageList(PackageList):
|
|||
section_title = self.PACKAGE_CATEGORIES[bundled_or_installed][package_type]
|
||||
package = PackageModel(package_info, section_title = section_title, parent = self)
|
||||
self._connectManageButtonSignals(package)
|
||||
package.setCanDowngrade(self._manager.canDowngrade(package_id))
|
||||
return package
|
||||
|
||||
def checkForUpdates(self, packages: List[Dict[str, Any]]):
|
||||
|
|
|
@ -67,7 +67,6 @@ class PackageModel(QObject):
|
|||
|
||||
self._can_update = False
|
||||
self._is_updating = 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.
|
||||
|
@ -309,8 +308,6 @@ class PackageModel(QObject):
|
|||
|
||||
disablePackageTriggered = pyqtSignal(str)
|
||||
|
||||
isRecentlyInstalledChanged = pyqtSignal(bool)
|
||||
|
||||
@pyqtProperty(bool, notify = stateManageButtonChanged)
|
||||
def isActive(self):
|
||||
return not self._package_id in self._plugin_registry.getDisabledPlugins()
|
||||
|
@ -345,15 +342,10 @@ class PackageModel(QObject):
|
|||
def isRecentlyUninstalled(self) -> bool:
|
||||
return self._package_id in self._package_manager.getPackagesToRemove()
|
||||
|
||||
def setCanDowngrade(self, value: bool) -> None:
|
||||
if value != self._can_downgrade:
|
||||
self._can_downgrade = value
|
||||
self.stateManageButtonChanged.emit()
|
||||
|
||||
@pyqtProperty(bool, fset = setCanDowngrade, notify = stateManageButtonChanged)
|
||||
@pyqtProperty(bool, notify = stateManageButtonChanged)
|
||||
def canDowngrade(self) -> bool:
|
||||
"""Flag if the installed package can be downgraded to a bundled version"""
|
||||
return self._can_downgrade
|
||||
return self._package_manager.canDowngrade(self._package_id)
|
||||
|
||||
def setIsUpdating(self, value):
|
||||
if value != self._is_updating:
|
||||
|
|
|
@ -220,8 +220,12 @@ Item
|
|||
|
||||
text:
|
||||
{
|
||||
if (packageData.canDowngrade) { return catalog.i18nc("@button", "Downgrade"); }
|
||||
if (packageData.isRecentlyInstalled) { return catalog.i18nc("@button", "Installed"); }
|
||||
if (packageData.isRecentlyUninstalled) { return catalog.i18nc("@button", "Uninstalled"); }
|
||||
if (packageData.isRecentlyUninstalled)
|
||||
{
|
||||
if (packageData.canDowngrade) { return catalog.i18nc("@button", "Downgraded") }
|
||||
else { return catalog.i18nc("@button", "Uninstalled"); } }
|
||||
if (button_style)
|
||||
{
|
||||
if (packageData.isInstalling) { return catalog.i18nc("@button", "Installing..."); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue