mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-22 06:03:57 -06:00
Check package upgradable using PM first, old plugins later
CURA-5718 For package upgradable, we need to check if a package is installed local. For that, we first check in the package manager, if nothing, then we fall back to check the old plugins.
This commit is contained in:
parent
1064d837ed
commit
3ac5a316d3
1 changed files with 9 additions and 5 deletions
|
@ -483,11 +483,13 @@ class Toolbox(QObject, Extension):
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@pyqtSlot(str, result = bool)
|
@pyqtSlot(str, result = bool)
|
||||||
def canUpdate(self, package_id: str) -> bool:
|
def canUpdate(self, package_id: str) -> bool:
|
||||||
if self.isOldPlugin(package_id):
|
|
||||||
return True
|
|
||||||
|
|
||||||
local_package = self._package_manager.getInstalledPackageInfo(package_id)
|
local_package = self._package_manager.getInstalledPackageInfo(package_id)
|
||||||
if local_package is None:
|
if local_package is None:
|
||||||
|
Logger.log("i", "Could not find package [%s] as installed in the package manager, fall back to check the old plugins",
|
||||||
|
package_id)
|
||||||
|
local_package = self.getOldPluginPackageMetadata(package_id)
|
||||||
|
if local_package is None:
|
||||||
|
Logger.log("i", "Could not find package [%s] in the old plugins", package_id)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
remote_package = self.getRemotePackage(package_id)
|
remote_package = self.getRemotePackage(package_id)
|
||||||
|
@ -556,12 +558,14 @@ class Toolbox(QObject, Extension):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check for plugins that were installed with the old plugin browser
|
# Check for plugins that were installed with the old plugin browser
|
||||||
@pyqtSlot(str, result = bool)
|
|
||||||
def isOldPlugin(self, plugin_id: str) -> bool:
|
def isOldPlugin(self, plugin_id: str) -> bool:
|
||||||
if plugin_id in self._old_plugin_ids:
|
if plugin_id in self._old_plugin_ids:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def getOldPluginPackageMetadata(self, plugin_id: str) -> Optional[Dict[str, Any]]:
|
||||||
|
return self._old_plugin_metadata.get(plugin_id)
|
||||||
|
|
||||||
def loadingComplete(self) -> bool:
|
def loadingComplete(self) -> bool:
|
||||||
populated = 0
|
populated = 0
|
||||||
for list in self._metadata.items():
|
for list in self._metadata.items():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue