diff --git a/plugins/3MFReader/ThreeMFWorkspaceReader.py b/plugins/3MFReader/ThreeMFWorkspaceReader.py index 82b73c66d9..74589b8335 100755 --- a/plugins/3MFReader/ThreeMFWorkspaceReader.py +++ b/plugins/3MFReader/ThreeMFWorkspaceReader.py @@ -738,11 +738,15 @@ class ThreeMFWorkspaceReader(WorkspaceReader): @staticmethod def _loadMetadata(file_name: str) -> Dict[str, Dict[str, Any]]: - archive = zipfile.ZipFile(file_name, "r") + result = dict() # type: Dict[str, Dict[str, Any]] + try: + archive = zipfile.ZipFile(file_name, "r") + except zipfile.BadZipFile: + Logger.logException("w", "Unable to retrieve metadata from {fname}: 3MF archive is corrupt.".format(fname = file_name)) + return result metadata_files = [name for name in archive.namelist() if name.endswith("plugin_metadata.json")] - result = dict() for metadata_file in metadata_files: try: diff --git a/plugins/ModelChecker/ModelChecker.py b/plugins/ModelChecker/ModelChecker.py index 5472a96809..057ee14945 100644 --- a/plugins/ModelChecker/ModelChecker.py +++ b/plugins/ModelChecker/ModelChecker.py @@ -86,7 +86,7 @@ class ModelChecker(QObject, Extension): if material_shrinkage[node_extruder_position] > shrinkage_threshold: bbox = node.getBoundingBox() - if bbox.width >= warning_size_xy or bbox.depth >= warning_size_xy or bbox.height >= warning_size_z: + if bbox is not None and (bbox.width >= warning_size_xy or bbox.depth >= warning_size_xy or bbox.height >= warning_size_z): warning_nodes.append(node) self._caution_message.setText(catalog.i18nc( diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index 09d27859b5..bfe803f224 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -149,6 +149,7 @@ class SolidView(View): theme = Application.getInstance().getTheme() self._xray_composite_shader.setUniformValue("u_background_color", Color(*theme.getColor("viewport_background").getRgb())) self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb())) + self._xray_composite_shader.setUniformValue("u_flat_error_color_mix", 0.) # Don't show flat error color in solid-view. renderer = self.getRenderer() if not self._composite_pass or not 'xray' in self._composite_pass.getLayerBindings(): diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py index c20456d243..36cc882681 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py @@ -232,11 +232,11 @@ class CloudOutputDeviceManager: return new_machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key) + self._setOutputDeviceMetadata(device, new_machine) + if activate: CuraApplication.getInstance().getMachineManager().setActiveMachine(new_machine.getId()) - self._connectToOutputDevice(device, new_machine) - def _connectToActiveMachine(self) -> None: """Callback for when the active machine was changed by the user""" @@ -258,14 +258,17 @@ class CloudOutputDeviceManager: # Remove device if it is not meant for the active machine. output_device_manager.removeOutputDevice(device.key) - def _connectToOutputDevice(self, device: CloudOutputDevice, machine: GlobalStack) -> None: - """Connects to an output device and makes sure it is registered in the output device manager.""" - + def _setOutputDeviceMetadata(self, device: CloudOutputDevice, machine: GlobalStack): machine.setName(device.name) machine.setMetaDataEntry(self.META_CLUSTER_ID, device.key) machine.setMetaDataEntry("group_name", device.name) machine.addConfiguredConnectionType(device.connectionType.value) + def _connectToOutputDevice(self, device: CloudOutputDevice, machine: GlobalStack) -> None: + """Connects to an output device and makes sure it is registered in the output device manager.""" + + self._setOutputDeviceMetadata(device, machine) + if not device.isConnected(): device.connect() diff --git a/plugins/UM3NetworkPrinting/src/Cloud/ToolPathUploader.py b/plugins/UM3NetworkPrinting/src/Cloud/ToolPathUploader.py index d5de7fe10a..6aa341c0e5 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/ToolPathUploader.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/ToolPathUploader.py @@ -125,7 +125,10 @@ class ToolPathUploader: if self._retries < self.MAX_RETRIES and status_code in self.RETRY_HTTP_CODES: self._retries += 1 Logger.log("i", "Retrying %s/%s request %s", self._retries, self.MAX_RETRIES, reply.url().toString()) - self._uploadChunk() + try: + self._uploadChunk() + except ValueError: # Asynchronously it could have completed in the meanwhile. + pass return # Http codes that are not to be retried are assumed to be errors. diff --git a/plugins/VersionUpgrade/VersionUpgrade45to46/VersionUpgrade45to46.py b/plugins/VersionUpgrade/VersionUpgrade45to46/VersionUpgrade45to46.py index f62264c3e7..a399c79535 100644 --- a/plugins/VersionUpgrade/VersionUpgrade45to46/VersionUpgrade45to46.py +++ b/plugins/VersionUpgrade/VersionUpgrade45to46/VersionUpgrade45to46.py @@ -29,11 +29,12 @@ class VersionUpgrade45to46(VersionUpgrade): parser["metadata"]["setting_version"] = "12" # Remove deleted settings from the visible settings list. - visible_settings = set(parser["general"]["visible_settings"].split(";")) - for removed in _removed_settings: - if removed in visible_settings: - visible_settings.remove(removed) - parser["general"]["visible_settings"] = ";".join(visible_settings) + if "general" in parser and "visible_settings" in parser["general"]: + visible_settings = set(parser["general"]["visible_settings"].split(";")) + for removed in _removed_settings: + if removed in visible_settings: + visible_settings.remove(removed) + parser["general"]["visible_settings"] = ";".join(visible_settings) result = io.StringIO() parser.write(result) diff --git a/plugins/XRayView/XRayView.py b/plugins/XRayView/XRayView.py index e12bd9b9ea..0144f4c176 100644 --- a/plugins/XRayView/XRayView.py +++ b/plugins/XRayView/XRayView.py @@ -93,6 +93,7 @@ class XRayView(CuraView): theme = Application.getInstance().getTheme() self._xray_composite_shader.setUniformValue("u_background_color", Color(*theme.getColor("viewport_background").getRgb())) self._xray_composite_shader.setUniformValue("u_outline_color", Color(*theme.getColor("model_selection_outline").getRgb())) + self._xray_composite_shader.setUniformValue("u_flat_error_color_mix", 1.) # Show flat error color _only_ in xray-view. if not self._composite_pass: self._composite_pass = self.getRenderer().getRenderPass("composite") diff --git a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml index a7701cf059..294a2474d6 100644 --- a/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml +++ b/resources/qml/Dialogs/DiscardOrKeepProfileChangesDialog.qml @@ -113,14 +113,14 @@ UM.Dialog TableViewColumn { role: "original_value" - title: catalog.i18nc("@title:column", "Default") + title: Cura.MachineManager.activeQualityDisplayNameMap["main"] width: (tableView.width * 0.3) | 0 delegate: defaultDelegate } TableViewColumn { role: "user_value" - title: catalog.i18nc("@title:column", "Customized") + title: catalog.i18nc("@title:column", "Current changes") width: (tableView.width * 0.3) | 0 } section.property: "category" @@ -192,7 +192,7 @@ UM.Dialog Button { id: discardButton - text: catalog.i18nc("@action:button", "Discard"); + text: catalog.i18nc("@action:button", "Discard changes"); anchors.right: parent.right onClicked: { @@ -205,7 +205,7 @@ UM.Dialog Button { id: keepButton - text: catalog.i18nc("@action:button", "Keep"); + text: catalog.i18nc("@action:button", "Keep changes"); anchors.right: discardButton.left anchors.rightMargin: UM.Theme.getSize("default_margin").width onClicked: diff --git a/resources/shaders/xray_composite.shader b/resources/shaders/xray_composite.shader index c955d4fc18..6619b00544 100644 --- a/resources/shaders/xray_composite.shader +++ b/resources/shaders/xray_composite.shader @@ -30,6 +30,7 @@ fragment = uniform vec4 u_outline_color; uniform vec4 u_background_color; uniform float u_xray_error_strength; + uniform float u_flat_error_color_mix; const vec3 x_axis = vec3(1.0, 0.0, 0.0); const vec3 y_axis = vec3(0.0, 1.0, 0.0); @@ -73,7 +74,7 @@ fragment = float rest = mod(intersection_count + .01, 2.0); if (rest > 1.0 && rest < 1.5 && intersection_count < 49.0) { - result = vec4(shiftHue(layer0.rgb, hue_shift), result.a); + result = mix(vec4(shiftHue(layer0.rgb, hue_shift), result.a), vec4(1.,0.,0.,1.), u_flat_error_color_mix); } vec4 sum = vec4(0.0); @@ -122,6 +123,7 @@ fragment41core = uniform vec4 u_outline_color; uniform vec4 u_background_color; uniform float u_xray_error_strength; + uniform float u_flat_error_color_mix; const vec3 x_axis = vec3(1.0, 0.0, 0.0); const vec3 y_axis = vec3(0.0, 1.0, 0.0); @@ -166,7 +168,7 @@ fragment41core = float rest = mod(intersection_count + .01, 2.0); if (rest > 1.0 && rest < 1.5 && intersection_count < 49) { - result = vec4(shiftHue(layer0.rgb, hue_shift), result.a); + result = mix(vec4(shiftHue(layer0.rgb, hue_shift), result.a), vec4(1.,0.,0.,1.), u_flat_error_color_mix); } vec4 sum = vec4(0.0); @@ -196,6 +198,7 @@ u_layer2 = 2 u_background_color = [0.965, 0.965, 0.965, 1.0] u_outline_strength = 1.0 u_outline_color = [0.05, 0.66, 0.89, 1.0] +u_flat_error_color_mix = 0.5 [bindings]