From 1285e1b5e5a3f44a4753ed33f1488f18fa48fa47 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Tue, 5 Jun 2018 11:00:05 +0200 Subject: [PATCH 1/3] CURA-5357 Move the plugin info in packages.json only when the installation succeeded. --- cura/CuraPackageManager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 096bfc9065..09253a4c77 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -105,7 +105,6 @@ class CuraPackageManager(QObject): while self._to_install_package_dict: package_id, package_info = list(self._to_install_package_dict.items())[0] self._installPackage(package_info) - self._installed_package_dict[package_id] = self._to_install_package_dict[package_id] del self._to_install_package_dict[package_id] self._saveManagementData() @@ -328,6 +327,8 @@ class CuraPackageManager(QObject): # Remove the file os.remove(filename) + # Move the info to the installed list of packages only when it succeeds + self._installed_package_dict[package_id] = self._to_install_package_dict[package_id] def __installPackageFiles(self, package_id: str, src_dir: str, dst_dir: str) -> None: Logger.log("i", "Moving package {package_id} from {src_dir} to {dst_dir}".format(package_id=package_id, src_dir=src_dir, dst_dir=dst_dir)) From c5929ce26c73a46b17bae5f4e1a944432e56e18b Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 5 Jun 2018 12:00:21 +0200 Subject: [PATCH 2/3] Revert "The prepare button slices, so it should be a slice button" This reverts commit a0263676e1305c2cc4b778ed5cfb7215e938705a. --- resources/qml/SaveButton.qml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 77537b0af2..0369f492b4 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -100,8 +100,8 @@ Item { if (saveToButton.enabled) { saveToButton.clicked(); } - // slice button - if (sliceButton.enabled) { + // prepare button + if (prepareButton.enabled) { sliceOrStopSlicing(); } } @@ -131,7 +131,7 @@ Item { Row { id: additionalComponentsRow anchors.top: parent.top - anchors.right: saveToButton.visible ? saveToButton.left : (sliceButton.visible ? sliceButton.left : parent.right) + anchors.right: saveToButton.visible ? saveToButton.left : (prepareButton.visible ? prepareButton.left : parent.right) anchors.rightMargin: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width @@ -159,14 +159,14 @@ Item { onPreferenceChanged: { var autoSlice = UM.Preferences.getValue("general/auto_slice"); - sliceButton.autoSlice = autoSlice; + prepareButton.autoSlice = autoSlice; saveToButton.autoSlice = autoSlice; } } - // Slice button, only shows if auto_slice is off + // Prepare button, only shows if auto_slice is off Button { - id: sliceButton + id: prepareButton tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process") // 1 = not started, 2 = Processing @@ -180,7 +180,7 @@ Item { anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width // 1 = not started, 4 = error, 5 = disabled - text: [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Slice") : catalog.i18nc("@label:Printjob", "Cancel") + text: [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel") onClicked: { sliceOrStopSlicing(); From 4652c3be0f32927e6a7755f42cc8edd63ab8d389 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 5 Jun 2018 12:46:32 +0200 Subject: [PATCH 3/3] Always try to remove old package files before installing new CURA-5442 --- cura/CuraPackageManager.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 3d4a360c7e..1ec9e2d993 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -306,9 +306,8 @@ class CuraPackageManager(QObject): Logger.log("i", "Installing package [%s] from file [%s]", package_id, filename) - # If it's installed, remove it first and then install - if package_id in self._installed_package_dict: - self._purgePackage(package_id) + # remove it first and then install + self._purgePackage(package_id) # Install the package with zipfile.ZipFile(filename, "r") as archive: