From d6e7b96437c863352aa75291142d8f7e3b866276 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 25 May 2018 10:49:16 +0200 Subject: [PATCH 1/9] Set machine preset to be equal to Replicator 1 Dual This was in the original Cura 15.06 plug-in. --- resources/definitions/malyan_m180.def.json | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/definitions/malyan_m180.def.json b/resources/definitions/malyan_m180.def.json index 11b61328ed..c74317a633 100644 --- a/resources/definitions/malyan_m180.def.json +++ b/resources/definitions/malyan_m180.def.json @@ -7,6 +7,7 @@ "visible": true, "author": "Ruben Dulek", "manufacturer": "Malyan", + "machine_x3g_variant": "r1d", "file_formats": "application/x3g" }, From f5a77071391f37d65f07d22e7bbd967cb706094e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 25 May 2018 11:24:31 +0200 Subject: [PATCH 2/9] Show ConfigurationErrorMessage when loading faulty XML files This is consistent with the rest of Cura's behaviour. --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 70d07c1fc5..f0d6915f04 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import copy @@ -12,10 +12,10 @@ import xml.etree.ElementTree as ET from UM.Resources import Resources from UM.Logger import Logger from cura.CuraApplication import CuraApplication - import UM.Dictionary from UM.Settings.InstanceContainer import InstanceContainer from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.ConfigurationErrorMessage import ConfigurationErrorMessage from .XmlMaterialValidator import XmlMaterialValidator @@ -540,7 +540,9 @@ class XmlMaterialProfile(InstanceContainer): validation_message = XmlMaterialValidator.validateMaterialMetaData(meta_data) if validation_message is not None: - raise Exception("Not valid material profile: %s" % (validation_message)) + ConfigurationErrorMessage.getInstance().addFaultyContainers(self.getId()) + Logger.log("e", "Not a valid material profile: {message}".format(message = validation_message)) + return property_values = {} properties = data.iterfind("./um:properties/*", self.__namespaces) From 7c0eb43a238dbce8c5efb3194d5282060ac01988 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 25 May 2018 11:44:37 +0200 Subject: [PATCH 3/9] Fix unpausing after cancelling a print The variable name is self._paused, not self._is_paused. This was doing nothing at all. --- plugins/USBPrinting/USBPrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index b2ca5562e3..dcc2387b07 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -385,7 +385,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): self._gcode.clear() self._printers[0].updateActivePrintJob(None) self._is_printing = False - self._is_paused = False + self._paused = False # Turn off temperatures, fan and steppers self._sendCommand("M140 S0") From 0d55b8b4406f3845ec32cc848827e1e193883b34 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 25 May 2018 12:04:00 +0200 Subject: [PATCH 4/9] Resume after pausing without waiting for next ok Previously the resume only worked because in the message receiving loop it would no longer ignore the next 'ok'. It doesn't actually send a message that would trigger an 'ok'. This only worked because we are polling every 2 seconds for the nozzle temperature which also happens to trigger an 'ok' response, which we interpret as a go-ahead for being able to send the next g-code line. Now it's no longer dependent on the fact that we happen to also poll the temperatures, so the code is more stable. And it also resumes immediately instead of waiting for up to 2 seconds. --- plugins/USBPrinting/USBPrinterOutputDevice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index dcc2387b07..00eb2f0b25 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -379,6 +379,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): def resumePrint(self): self._paused = False + self._sendNextGcodeLine() #Send one line of g-code next so that we'll trigger an "ok" response loop even if we're not polling temperatures. def cancelPrint(self): self._gcode_position = 0 From 689b88a02466e9dfce2e1506bd0377467f30f624 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 28 May 2018 09:53:47 +0200 Subject: [PATCH 5/9] Do not change prefix for user-specified job names CURA-5280 --- cura/PrintInformation.py | 30 +++++++++++++++++++----------- resources/qml/JobSpecs.qml | 2 +- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 3260d55c74..2c9f6511fa 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -65,6 +65,7 @@ class PrintInformation(QObject): self._backend.printDurationMessage.connect(self._onPrintDurationMessage) Application.getInstance().getController().getScene().sceneChanged.connect(self._onSceneChanged) + self._is_user_specified_job_name = False self._base_name = "" self._abbr_machine = "" self._job_name = "" @@ -281,10 +282,13 @@ class PrintInformation(QObject): # Manual override of job name should also set the base name so that when the printer prefix is updated, it the # prefix can be added to the manually added name, not the old base name - @pyqtSlot(str) - def setJobName(self, name): + @pyqtSlot(str, bool) + def setJobName(self, name, is_user_specified_job_name = False): + self._is_user_specified_job_name = is_user_specified_job_name self._job_name = name self._base_name = name.replace(self._abbr_machine + "_", "") + if name == "": + self._is_user_specified_job_name = False self.jobNameChanged.emit() jobNameChanged = pyqtSignal() @@ -296,21 +300,25 @@ class PrintInformation(QObject): def _updateJobName(self): if self._base_name == "": self._job_name = "" + self._is_user_specified_job_name = False self.jobNameChanged.emit() return base_name = self._stripAccents(self._base_name) self._setAbbreviatedMachineName() - if self._pre_sliced: - self._job_name = catalog.i18nc("@label", "Pre-sliced file {0}", base_name) - elif Preferences.getInstance().getValue("cura/jobname_prefix"): - # Don't add abbreviation if it already has the exact same abbreviation. - if base_name.startswith(self._abbr_machine + "_"): - self._job_name = base_name + + # Only update the job name when it's not user-specified. + if not self._is_user_specified_job_name: + if self._pre_sliced: + self._job_name = catalog.i18nc("@label", "Pre-sliced file {0}", base_name) + elif Preferences.getInstance().getValue("cura/jobname_prefix"): + # Don't add abbreviation if it already has the exact same abbreviation. + if base_name.startswith(self._abbr_machine + "_"): + self._job_name = base_name + else: + self._job_name = self._abbr_machine + "_" + base_name else: - self._job_name = self._abbr_machine + "_" + base_name - else: - self._job_name = base_name + self._job_name = base_name self.jobNameChanged.emit() diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index e7f2d304b5..579f9bcc05 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -81,7 +81,7 @@ Item { text: PrintInformation.jobName horizontalAlignment: TextInput.AlignRight onTextChanged: { - PrintInformation.setJobName(text); + PrintInformation.setJobName(text, true); } onEditingFinished: { if (printJobTextfield.text != ''){ From ad131ab30c0312e40a871df4faac9351bc298004 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 28 May 2018 11:18:22 +0200 Subject: [PATCH 6/9] Fix downgrade packages to bundled version CURA-5296 --- cura/CuraPackageManager.py | 6 ++++++ plugins/Toolbox/src/Toolbox.py | 12 +++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index a4b60b3251..7f0d49cf12 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -111,6 +111,12 @@ class CuraPackageManager(QObject): del self._to_install_package_dict[package_id] self._saveManagementData() + def getBundledPackageInfo(self, package_id: str) -> Optional[dict]: + package_info = None + if package_id in self._bundled_package_dict: + package_info = self._bundled_package_dict[package_id]["package_info"] + return package_info + # Checks the given package is installed. If so, return a dictionary that contains the package's information. def getInstalledPackageInfo(self, package_id: str) -> Optional[dict]: if package_id in self._to_remove_package_set: diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 6dac823f06..824a7e30f3 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -318,19 +318,21 @@ class Toolbox(QObject, Extension): remote_version = Version(remote_package["package_version"]) return remote_version > local_version - @pyqtSlot(str, result=bool) + @pyqtSlot(str, result = bool) def canDowngrade(self, package_id: str) -> bool: + # If the currently installed version is higher than the bundled version (if present), the we can downgrade + # this package. local_package = self._package_manager.getInstalledPackageInfo(package_id) if local_package is None: return False - remote_package = self.getRemotePackage(package_id) - if remote_package is None: + bundled_package = self._package_manager.getBundledPackageInfo(package_id) + if bundled_package is None: return False local_version = Version(local_package["package_version"]) - remote_version = Version(remote_package["package_version"]) - return remote_version < local_version + bundled_version = Version(bundled_package["package_version"]) + return bundled_version < local_version @pyqtSlot(str, result = bool) def isInstalled(self, package_id: str) -> bool: From 43fcb183aee8f2bee2b01abd53564a7f749c0b35 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 28 May 2018 13:09:55 +0200 Subject: [PATCH 7/9] Remove unnecessary code CURA-5296 --- cura/CuraPackageManager.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/cura/CuraPackageManager.py b/cura/CuraPackageManager.py index 7f0d49cf12..bc2e020037 100644 --- a/cura/CuraPackageManager.py +++ b/cura/CuraPackageManager.py @@ -89,7 +89,6 @@ class CuraPackageManager(QObject): "installed": self._installed_package_dict, "to_remove": list(self._to_remove_package_set), "to_install": self._to_install_package_dict} - data_dict["to_remove"] = list(data_dict["to_remove"]) json.dump(data_dict, f, sort_keys = True, indent = 4) Logger.log("i", "Package management file %s was saved", self._user_package_management_file_path) @@ -103,7 +102,6 @@ class CuraPackageManager(QObject): # (for initialize) Installs all packages that have been scheduled to be installed. def _installAllScheduledPackages(self) -> None: - while self._to_install_package_dict: package_id, package_info = list(self._to_install_package_dict.items())[0] self._installPackage(package_info) From 57ca41291a8859c4f0d0156c25d609e759e62e1e Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 28 May 2018 13:10:18 +0200 Subject: [PATCH 8/9] Fix package upgrade CURA-5296 The removal of already installed package is already handled by the package manager in the package upgrade. Removing the package before the download starts will make the package to be removed before the new content is available and its license gets approved by the user. --- plugins/Toolbox/src/Toolbox.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 824a7e30f3..ea6bdf791c 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -250,8 +250,6 @@ class Toolbox(QObject, Extension): if remote_package: download_url = remote_package["download_url"] Logger.log("d", "Updating package [%s]..." % 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) From 24b8ea4a4b1a738463c78475d83b366725de8ed4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Mon, 28 May 2018 13:18:52 +0200 Subject: [PATCH 9/9] Quality changes are now in the quality_changes folder CURA-5296 --- plugins/VersionUpgrade/VersionUpgrade33to34/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade33to34/__init__.py b/plugins/VersionUpgrade/VersionUpgrade33to34/__init__.py index c36247353f..4faa1290b5 100644 --- a/plugins/VersionUpgrade/VersionUpgrade33to34/__init__.py +++ b/plugins/VersionUpgrade/VersionUpgrade33to34/__init__.py @@ -21,7 +21,7 @@ def getMetaData(): }, "quality_changes": { "get_version": upgrade.getCfgVersion, - "location": {"./quality"} + "location": {"./quality_changes"} }, "user": { "get_version": upgrade.getCfgVersion,