mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Cleanup and simplify toolbox plugin update
This commit is contained in:
parent
0f0b6a9712
commit
1f088aabc4
3 changed files with 10 additions and 20 deletions
|
@ -194,11 +194,6 @@ class CuraPackageManager(QObject):
|
||||||
return
|
return
|
||||||
package_id = package_info["package_id"]
|
package_id = package_info["package_id"]
|
||||||
|
|
||||||
# # Check the delayed installation and removal lists first
|
|
||||||
# if package_id in self._to_remove_package_set:
|
|
||||||
# self._to_remove_package_set.remove(package_id)
|
|
||||||
# has_changes = True
|
|
||||||
|
|
||||||
# Check if it is installed
|
# Check if it is installed
|
||||||
installed_package_info = self.getInstalledPackageInfo(package_info["package_id"])
|
installed_package_info = self.getInstalledPackageInfo(package_info["package_id"])
|
||||||
to_install_package = installed_package_info is None # Install if the package has not been installed
|
to_install_package = installed_package_info is None # Install if the package has not been installed
|
||||||
|
|
|
@ -37,10 +37,7 @@ Column
|
||||||
font: UM.Theme.getFont("default_bold")
|
font: UM.Theme.getFont("default_bold")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: toolbox.update(model.id)
|
||||||
// Must do all stuff in 1 function as the current ToolboxInstalledTile object is going to disappear...
|
|
||||||
toolbox.update(model.id)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ProgressBar
|
ProgressBar
|
||||||
{
|
{
|
||||||
|
|
|
@ -228,9 +228,15 @@ class Toolbox(QObject, Extension):
|
||||||
def _update(self) -> None:
|
def _update(self) -> None:
|
||||||
if self._to_update:
|
if self._to_update:
|
||||||
plugin_id = self._to_update.pop(0)
|
plugin_id = self._to_update.pop(0)
|
||||||
Logger.log("d", "Updating package [%s]..." % plugin_id)
|
remote_package = self.getRemotePackage(plugin_id)
|
||||||
self.uninstall(plugin_id)
|
if remote_package:
|
||||||
self.startDownload(self.getRemotePackageURL(plugin_id))
|
download_url = remote_package["download_url"]
|
||||||
|
Logger.log("d", "Updating package [%s]..." % 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)
|
||||||
|
|
||||||
if self._to_update:
|
if self._to_update:
|
||||||
self._application.callLater(self._update)
|
self._application.callLater(self._update)
|
||||||
|
|
||||||
|
@ -277,14 +283,6 @@ class Toolbox(QObject, Extension):
|
||||||
break
|
break
|
||||||
return remote_package
|
return remote_package
|
||||||
|
|
||||||
@pyqtSlot(str, result = str)
|
|
||||||
def getRemotePackageURL(self, package_id: str) -> str:
|
|
||||||
remote_package = self.getRemotePackage(package_id)
|
|
||||||
if remote_package:
|
|
||||||
return remote_package["download_url"]
|
|
||||||
else:
|
|
||||||
return ""
|
|
||||||
|
|
||||||
# Checks
|
# Checks
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
@pyqtSlot(str, result = bool)
|
@pyqtSlot(str, result = bool)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue