From 0fdd9279bbf5962ac595b53d57b8ee020c5aed7d Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 13 Sep 2016 14:04:49 +0200 Subject: [PATCH 1/6] Resolvement strategy for bed adhesion and prime tower enable. Contributes to CURA-2232 No resolvement strategy for prime_tower_enable and platform adhesion --- resources/definitions/fdmprinter.def.json | 2 ++ resources/qml/Settings/SettingCheckBox.qml | 32 ++++++++++++++++++---- resources/qml/Settings/SettingComboBox.qml | 13 ++++++++- 3 files changed, 41 insertions(+), 6 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index ba823f6d40..e1184ad6ac 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -2705,6 +2705,7 @@ "raft": "Raft" }, "default_value": "brim", + "resolve": "'raft' if 'raft' in extruderValues('adhesion_type') else ('brim' if 'brim' in extruderValues('adhesion_type') else 'skirt')", "settable_per_mesh": false, "settable_per_extruder": false }, @@ -3296,6 +3297,7 @@ "type": "bool", "enabled": "machine_extruder_count > 1", "default_value": false, + "resolve": "max(extruderValues('prime_tower_enable'))", "settable_per_mesh": false, "settable_per_extruder": false }, diff --git a/resources/qml/Settings/SettingCheckBox.qml b/resources/qml/Settings/SettingCheckBox.qml index 9b50c82395..1fcd24ccf6 100644 --- a/resources/qml/Settings/SettingCheckBox.qml +++ b/resources/qml/Settings/SettingCheckBox.qml @@ -20,18 +20,40 @@ SettingItem property bool checked: { - switch(propertyProvider.properties.value) + // FIXME this needs to go away once 'resolve' is combined with 'value' in our data model. + // Stacklevels + // 0: user -> unsaved change + // 1: quality changes -> saved change + // 2: quality + // 3: material -> user changed material in materials page + // 4: variant + // 5: machine + var value; + if ((propertyProvider.properties.resolve != "None") && (stackLevel != 0) && (stackLevel != 1)) { + // We have a resolve function. Indicates that the setting is not settable per extruder and that + // we have to choose between the resolved value (default) and the global value + // (if user has explicitly set this). + value = propertyProvider.properties.resolve; + } else { + value = propertyProvider.properties.value; + } + + switch(value) { case "True": - return true + return true; case "False": - return false + return false; default: - return propertyProvider.properties.value + return value; } } - onClicked: { forceActiveFocus(); propertyProvider.setPropertyValue("value", !checked) } + onClicked: + { + forceActiveFocus(); + propertyProvider.setPropertyValue("value", !checked); + } Rectangle { diff --git a/resources/qml/Settings/SettingComboBox.qml b/resources/qml/Settings/SettingComboBox.qml index 283e309e6a..0f6bab438d 100644 --- a/resources/qml/Settings/SettingComboBox.qml +++ b/resources/qml/Settings/SettingComboBox.qml @@ -96,8 +96,19 @@ SettingItem } function updateCurrentIndex() { + // FIXME this needs to go away once 'resolve' is combined with 'value' in our data model. + var value; + if ((propertyProvider.properties.resolve != "None") && (stackLevel != 0) && (stackLevel != 1)) { + // We have a resolve function. Indicates that the setting is not settable per extruder and that + // we have to choose between the resolved value (default) and the global value + // (if user has explicitly set this). + value = propertyProvider.properties.resolve; + } else { + value = propertyProvider.properties.value; + } + for(var i = 0; i < definition.options.length; ++i) { - if(definition.options[i].key == propertyProvider.properties.value) { + if(definition.options[i].key == value) { currentIndex = i; return; } From 4db1db302b27810c664c59cd1fc1e847190accc2 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Sep 2016 14:35:45 +0200 Subject: [PATCH 2/6] Changed guid to GUID in the filter We use the veriable as upper. --- cura/PrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index dfd1c1d8d6..300e76a192 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -286,7 +286,7 @@ class PrinterOutputDevice(QObject, OutputDevice): result.append(i18n_catalog.i18nc("@item:material", "No material loaded")) continue - containers = self._container_registry.findInstanceContainers(type = "material", guid = material_id) + containers = self._container_registry.findInstanceContainers(type = "material", GUID = material_id) if containers: result.append(containers[0].getName()) else: From d6e95d27344203b67bc60e6e2c4840a8c4dc48af Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Sep 2016 14:54:17 +0200 Subject: [PATCH 3/6] Added error state for container state if serialization data is none CURA-2359 --- cura/Settings/ContainerManager.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index cb3ae88914..e3a0d22299 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -349,6 +349,9 @@ class ContainerManager(QObject): except NotImplementedError: return { "status": "error", "message": "Unable to serialize container"} + if contents is None: + return {"status": "error", "message": "Serialization returned None. Unable to write to file"} + with UM.SaveFile(file_url, "w") as f: f.write(contents) From b707c8d806816182add4762e34d794202bd1fba3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Tue, 13 Sep 2016 14:57:00 +0200 Subject: [PATCH 4/6] XML profile now returns serialization data even if it's read only This way exporting read only profiles is possible again. CURA-2359 --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 58e7a89cad..bf3f34b667 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -85,9 +85,6 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): # base file: global settings + supported machines # machine / variant combination: only changes for itself. def serialize(self): - if self._read_only: - return - registry = UM.Settings.ContainerRegistry.getInstance() base_file = self.getMetaDataEntry("base_file", "") From 89fb92edbddcdea50e9db612a1ca5a0b8fdd09b5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 13 Sep 2016 13:58:02 +0200 Subject: [PATCH 5/6] Disable upgrading current settings altogether The current settings in 2.1 specified a machine instance. In 2.2 they specify a machine definition. There is not enough information in one file to be able to translate that. Contributes to issue CURA-844. --- .../VersionUpgrade/VersionUpgrade21to22/MachineInstance.py | 5 +---- plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py b/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py index cab1c00852..6510d34cb1 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/MachineInstance.py @@ -91,12 +91,9 @@ class MachineInstance: if has_machine_qualities: #This machine now has machine-quality profiles. active_material += "_" + variant_materials #That means that the profile was split into multiple. - current_settings = "" #The profile didn't know the definition ID when it was upgraded, so it will have been invalid. Sorry, your current settings are lost now. - else: - current_settings = self._name + "_current_settings" containers = [ - current_settings, + "", #The current profile doesn't know the definition ID when it was upgraded, only the instance ID, so it will be invalid. Sorry, your current settings are lost now. active_quality_changes, active_quality, active_material, diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py index 6c940b97cf..ff404c0398 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py @@ -80,7 +80,7 @@ class Profile: import VersionUpgrade21to22 # Import here to prevent circular dependencies. if self._name == "Current settings": - self._filename += "_current_settings" #This resolves a duplicate ID arising from how Cura 2.1 stores its current settings. + return None #Can't upgrade these, because the new current profile needs to specify the definition ID and the old file only had the machine instance, not the definition. config = configparser.ConfigParser(interpolation = None) From 31b0f748744b1bc957ab74ea5bdffa18a830935d Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Tue, 13 Sep 2016 15:09:33 +0200 Subject: [PATCH 6/6] Change url of cura stats. CURA-1445 --- plugins/SliceInfoPlugin/SliceInfo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 359066d1f4..ab9a75d1da 100644 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -46,9 +46,11 @@ class SliceInfoJob(Job): if Platform.isOSX(): kwoptions["context"] = ssl._create_unverified_context() + Logger.log("d", "Sending anonymous slice info to [%s]...", self.url) + try: f = urllib.request.urlopen(self.url, **kwoptions) - Logger.log("i", "Sent anonymous slice info to %s", self.url) + Logger.log("i", "Sent anonymous slice info.") f.close() except urllib.error.HTTPError as http_exception: Logger.log("e", "An HTTP error occurred while trying to send slice information: %s" % http_exception) @@ -59,7 +61,7 @@ class SliceInfoJob(Job): # The data is only sent when the user in question gave permission to do so. All data is anonymous and # no model files are being sent (Just a SHA256 hash of the model). class SliceInfo(Extension): - info_url = "https://stats.youmagine.com/curastats/slice" + info_url = "http://stats.youmagine.com/curastats/slice" def __init__(self): super().__init__()