mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-21 21:58:01 -06:00
Set the is_recently_installed flag
Contributes to: CURA-8587
This commit is contained in:
parent
14bc196154
commit
9e4258ef8b
3 changed files with 18 additions and 6 deletions
|
@ -65,10 +65,10 @@ class LocalPackageList(PackageList):
|
|||
package_type = package_info["package_type"]
|
||||
section_title = self.PACKAGE_CATEGORIES[bundled_or_installed][package_type]
|
||||
package = PackageModel(package_info, section_title = section_title, parent = self)
|
||||
if package_id in self._manager.getPackagesToRemove() or package_id in self._manager.getPackagesToInstall():
|
||||
package.is_recently_managed = True
|
||||
package.can_downgrade = self._manager.canDowngrade(package_id)
|
||||
self._connectManageButtonSignals(package)
|
||||
package.can_downgrade = self._manager.canDowngrade(package_id)
|
||||
if package_id in self._manager.getPackagesToRemove() or package_id in self._manager.getPackagesToInstall():
|
||||
package.is_recently_installed = True
|
||||
return package
|
||||
|
||||
def checkForUpdates(self, packages: List[Dict[str, Any]]):
|
||||
|
|
|
@ -7,7 +7,6 @@ from typing import Any, Dict, List, Optional
|
|||
|
||||
from PyQt5.QtCore import pyqtProperty, QObject, pyqtSignal
|
||||
|
||||
from cura.CuraApplication import CuraApplication
|
||||
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry # To get names of materials we're compatible with.
|
||||
from UM.i18n import i18nCatalog # To translate placeholder names if data is not present.
|
||||
|
||||
|
@ -70,7 +69,7 @@ class PackageModel(QObject):
|
|||
self._icon_url = author_data.get("icon_url", "")
|
||||
|
||||
self._is_installing: ManageState = ManageState.HALTED
|
||||
self._is_recently_installed = self._package_id in CuraApplication.getInstance().getPackageManager().getPackagesToInstall()
|
||||
self._is_recently_installed = False
|
||||
self._is_recently_updated = False
|
||||
self._is_recently_enabled = False
|
||||
|
||||
|
@ -361,6 +360,16 @@ class PackageModel(QObject):
|
|||
self._is_recently_installed = True
|
||||
self.stateManageButtonChanged.emit()
|
||||
|
||||
@property
|
||||
def is_recently_installed(self):
|
||||
return self._is_recently_installed
|
||||
|
||||
@is_recently_installed.setter
|
||||
def is_recently_installed(self, value):
|
||||
if value != self._is_recently_installed:
|
||||
value = self._is_recently_installed
|
||||
self.stateManageButtonChanged.emit()
|
||||
|
||||
@property
|
||||
def can_downgrade(self) -> bool:
|
||||
"""Flag if the installed package can be downgraded to a bundled version"""
|
||||
|
|
|
@ -129,11 +129,14 @@ class RemotePackageList(PackageList):
|
|||
return
|
||||
|
||||
for package_data in response_data["data"]:
|
||||
if package_data["package_id"] in self._local_packages:
|
||||
package_id = package_data["package_id"]
|
||||
if package_id in self._local_packages:
|
||||
continue # We should only show packages which are not already installed
|
||||
try:
|
||||
package = PackageModel(package_data, parent = self)
|
||||
self._connectManageButtonSignals(package)
|
||||
if package_id in self._manager.getPackagesToRemove() or package_id in self._manager.getPackagesToInstall():
|
||||
package.is_recently_installed = True
|
||||
self.appendItem({"package": package}) # Add it to this list model.
|
||||
except RuntimeError:
|
||||
# Setting the ownership of this object to not qml can still result in a RuntimeError. Which can occur when quickly toggling
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue