diff options
-rw-r--r-- | cura/CuraPackageManager.py | 3 | ||||
-rw-r--r-- | plugins/Toolbox/src/Toolbox.py | 14 |
2 files changed, 8 insertions, 9 deletions
diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index ff93c2b010..95b381989f 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -4,7 +4,6 @@ from cura.CuraApplication import CuraApplication #To find some resource types. from cura.Settings.GlobalStack import GlobalStack -from UM.Logger import Logger from UM.PackageManager import PackageManager #The class we're extending. from UM.Resources import Resources #To find storage paths for some resource types. from UM.Settings.ContainerRegistry import ContainerRegistry @@ -24,7 +23,7 @@ class CuraPackageManager(PackageManager): # empty if it is never used. # It loops through all the package contents and see if some of the ids are used. # The list consists of 3-tuples: (global_stack, extruder_nr, container_id) - def packageUsed(self, package_id: str): + def getMachinesUsingPackage(self, package_id: str): ids = self.getPackageContainerIds(package_id) container_stacks = ContainerRegistry.getInstance().findContainerStacks() global_stacks = [container_stack for container_stack in container_stacks if isinstance(container_stack, GlobalStack)] diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 90d135c289..4e59fcd055 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -314,12 +314,12 @@ class Toolbox(QObject, Extension): ## Check package usage and uninstall # If the package is in use, you'll get a confirmation dialog to set everything to default @pyqtSlot(str) - def checkPackageUsageAndUninstall(self, plugin_id: str) -> None: - package_used_materials, package_used_qualities = self._package_manager.packageUsed(plugin_id) + def checkPackageUsageAndUninstall(self, package_id: str) -> None: + package_used_materials, package_used_qualities = self._package_manager.getMachinesUsingPackage(package_id) if package_used_materials or package_used_qualities: # Set up "uninstall variables" for resetMaterialsQualitiesAndUninstall - self._package_id_to_uninstall = plugin_id - package_info = self._package_manager.getInstalledPackageInfo(plugin_id) + self._package_id_to_uninstall = package_id + package_info = self._package_manager.getInstalledPackageInfo(package_id) self._package_name_to_uninstall = package_info.get("display_name", package_info.get("package_id")) self._package_used_materials = package_used_materials self._package_used_qualities = package_used_qualities @@ -330,7 +330,7 @@ class Toolbox(QObject, Extension): self._confirm_reset_dialog.show() else: # Plain uninstall - self.uninstall(plugin_id) + self.uninstall(package_id) @pyqtProperty(str, notify = uninstallVariablesChanged) def pluginToUninstall(self): @@ -368,8 +368,8 @@ class Toolbox(QObject, Extension): self.closeConfirmResetDialog() @pyqtSlot(str) - def uninstall(self, plugin_id: str) -> None: - self._package_manager.removePackage(plugin_id, force_add = True) + def uninstall(self, package_id: str) -> None: + self._package_manager.removePackage(package_id, force_add = True) self.installChanged.emit() self._updateInstalledModels() self.metadataChanged.emit() |