mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Fix uninstallable user package which was also bundled; make update package somewhat better by not trying to uninstall builtin package
This commit is contained in:
parent
fd73751b91
commit
9281c23555
2 changed files with 9 additions and 4 deletions
|
@ -171,7 +171,7 @@ class CuraPackageManager(QObject):
|
|||
package_info["is_active"] = self._plugin_registry.isActivePlugin(package_id)
|
||||
|
||||
# If the package ID is in bundled, label it as such
|
||||
package_info["is_bundled"] = package_info["package_id"] in self._bundled_package_dict.keys()
|
||||
package_info["is_bundled"] = package_info["package_id"] in self._bundled_package_dict.keys() and not self.isUserInstalledPackage(package_info["package_id"])
|
||||
|
||||
# If there is not a section in the dict for this type, add it
|
||||
if package_info["package_type"] not in installed_packages_dict:
|
||||
|
@ -182,7 +182,7 @@ class CuraPackageManager(QObject):
|
|||
|
||||
return installed_packages_dict
|
||||
|
||||
# Checks if the given package is installed.
|
||||
# Checks if the given package is installed (at all).
|
||||
def isPackageInstalled(self, package_id: str) -> bool:
|
||||
return self.getInstalledPackageInfo(package_id) is not None
|
||||
|
||||
|
@ -242,7 +242,7 @@ class CuraPackageManager(QObject):
|
|||
Logger.log("i", "Attempt to remove package [%s] that is not installed, do nothing.", package_id)
|
||||
return
|
||||
|
||||
# Temp hack
|
||||
# Extra safety check
|
||||
if package_id not in self._installed_package_dict and package_id in self._bundled_package_dict:
|
||||
Logger.log("i", "Not uninstalling [%s] because it is a bundled package.")
|
||||
return
|
||||
|
@ -258,6 +258,10 @@ class CuraPackageManager(QObject):
|
|||
self._saveManagementData()
|
||||
self.installedPackagesChanged.emit()
|
||||
|
||||
## Is the package an user installed package?
|
||||
def isUserInstalledPackage(self, package_id: str):
|
||||
return package_id in self._installed_package_dict
|
||||
|
||||
# Removes everything associated with the given package ID.
|
||||
def _purgePackage(self, package_id: str) -> None:
|
||||
# Iterate through all directories in the data storage directory and look for sub-directories that belong to
|
||||
|
|
|
@ -232,7 +232,8 @@ class Toolbox(QObject, Extension):
|
|||
if remote_package:
|
||||
download_url = remote_package["download_url"]
|
||||
Logger.log("d", "Updating package [%s]..." % plugin_id)
|
||||
self.uninstall(plugin_id)
|
||||
if self._package_manager.isUserInstalledPackage(plugin_id):
|
||||
self.uninstall(plugin_id)
|
||||
self.startDownload(download_url)
|
||||
else:
|
||||
Logger.log("e", "Could not update package [%s] because there is no remote package info available.", plugin_id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue