mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Remove a recently installed and then uninstalled package from the manage list
Contributes to CURA-8587
This commit is contained in:
parent
62c6af1ef3
commit
8abeb24ccc
3 changed files with 11 additions and 2 deletions
|
|
@ -41,11 +41,21 @@ class LocalPackageList(PackageList):
|
|||
self._has_footer = False
|
||||
self._ongoing_requests["check_updates"] = None
|
||||
self._package_manager.packagesWithUpdateChanged.connect(self._sortSectionsOnUpdate)
|
||||
self._package_manager.packageUninstalled.connect(self._removePackageModel)
|
||||
|
||||
def _sortSectionsOnUpdate(self) -> None:
|
||||
SECTION_ORDER = dict(zip([i for k, v in self.PACKAGE_CATEGORIES.items() for i in self.PACKAGE_CATEGORIES[k].values()], ["a", "b", "c", "d"]))
|
||||
self.sort(lambda model: f"{SECTION_ORDER[model.sectionTitle]}_{model._can_update}_{model.displayName}".lower(), key = "package")
|
||||
|
||||
def _removePackageModel(self, package_id):
|
||||
if package_id not in self._package_manager.local_packages_ids:
|
||||
index = self.find("package", package_id)
|
||||
if index < 0:
|
||||
Logger.error(f"Could not find card in Listview corresponding with {package_id}")
|
||||
self.updatePackages()
|
||||
return
|
||||
self.removeItem(index)
|
||||
|
||||
@pyqtSlot()
|
||||
def updatePackages(self) -> None:
|
||||
"""Update the list with local packages, these are materials or plugin, either bundled or user installed. The list
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue