From 1136033f9799ed1249dfb4f988511a12853b1a12 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Sep 2018 10:50:07 +0200 Subject: [PATCH 1/2] Remove superfluous check for 'ok T:' This check is never hit because if there is 'ok T:' in the bytes array then it will have hit the first check for 'ok ' and 'T:'. --- 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 45b566fcab..4ceda52875 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -326,7 +326,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice): if self._firmware_name is None: self.sendCommand("M115") - if (b"ok " in line and b"T:" in line) or b"ok T:" in line or line.startswith(b"T:") or b"ok B:" in line or line.startswith(b"B:"): # Temperature message. 'T:' for extruder and 'B:' for bed + if (b"ok " in line and b"T:" in line) or line.startswith(b"T:") or b"ok B:" in line or line.startswith(b"B:"): # Temperature message. 'T:' for extruder and 'B:' for bed extruder_temperature_matches = re.findall(b"T(\d*): ?([\d\.]+) ?\/?([\d\.]+)?", line) # Update all temperature values matched_extruder_nrs = [] From 6df029971d2f0dc4070959c892f2d79c3cf1cb04 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 3 Sep 2018 11:02:24 +0200 Subject: [PATCH 2/2] Don't crash if layer height is a formula We obtain the layer height here but that might be a formula so we should evaluate that formula here. Fixes #4005. --- cura/Machines/Models/QualityProfilesDropDownMenuModel.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cura/Machines/Models/QualityProfilesDropDownMenuModel.py b/cura/Machines/Models/QualityProfilesDropDownMenuModel.py index 59c4f4fa5b..dc2482ed45 100644 --- a/cura/Machines/Models/QualityProfilesDropDownMenuModel.py +++ b/cura/Machines/Models/QualityProfilesDropDownMenuModel.py @@ -6,10 +6,10 @@ from PyQt5.QtCore import Qt from UM.Application import Application from UM.Logger import Logger from UM.Qt.ListModel import ListModel +from UM.Settings.SettingFunction import SettingFunction from cura.Machines.QualityManager import QualityGroup - # # QML Model for all built-in quality profiles. This model is used for the drop-down quality menu. # @@ -106,4 +106,8 @@ class QualityProfilesDropDownMenuModel(ListModel): container = global_stack.definition if container and container.hasProperty("layer_height", "value"): layer_height = container.getProperty("layer_height", "value") + + if isinstance(layer_height, SettingFunction): + layer_height = layer_height() + return float(layer_height)