mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 08:17:49 -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)
|
package_info["is_active"] = self._plugin_registry.isActivePlugin(package_id)
|
||||||
|
|
||||||
# If the package ID is in bundled, label it as such
|
# 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 there is not a section in the dict for this type, add it
|
||||||
if package_info["package_type"] not in installed_packages_dict:
|
if package_info["package_type"] not in installed_packages_dict:
|
||||||
|
@ -182,7 +182,7 @@ class CuraPackageManager(QObject):
|
||||||
|
|
||||||
return installed_packages_dict
|
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:
|
def isPackageInstalled(self, package_id: str) -> bool:
|
||||||
return self.getInstalledPackageInfo(package_id) is not None
|
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)
|
Logger.log("i", "Attempt to remove package [%s] that is not installed, do nothing.", package_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
# Temp hack
|
# Extra safety check
|
||||||
if package_id not in self._installed_package_dict and package_id in self._bundled_package_dict:
|
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.")
|
Logger.log("i", "Not uninstalling [%s] because it is a bundled package.")
|
||||||
return
|
return
|
||||||
|
@ -258,6 +258,10 @@ class CuraPackageManager(QObject):
|
||||||
self._saveManagementData()
|
self._saveManagementData()
|
||||||
self.installedPackagesChanged.emit()
|
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.
|
# Removes everything associated with the given package ID.
|
||||||
def _purgePackage(self, package_id: str) -> None:
|
def _purgePackage(self, package_id: str) -> None:
|
||||||
# Iterate through all directories in the data storage directory and look for sub-directories that belong to
|
# Iterate through all directories in the data storage directory and look for sub-directories that belong to
|
||||||
|
|
|
@ -232,6 +232,7 @@ class Toolbox(QObject, Extension):
|
||||||
if remote_package:
|
if remote_package:
|
||||||
download_url = remote_package["download_url"]
|
download_url = remote_package["download_url"]
|
||||||
Logger.log("d", "Updating package [%s]..." % plugin_id)
|
Logger.log("d", "Updating package [%s]..." % plugin_id)
|
||||||
|
if self._package_manager.isUserInstalledPackage(plugin_id):
|
||||||
self.uninstall(plugin_id)
|
self.uninstall(plugin_id)
|
||||||
self.startDownload(download_url)
|
self.startDownload(download_url)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue