From 19b5938c76bb54f038c85206ac9e8b8ef7e5002c Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Fri, 24 Feb 2017 12:32:28 -0800 Subject: [PATCH 1/3] Only show whole numbers on printing screen --- CustomWidgets/PrintingWindow.cs | 8 ++++---- Submodules/MatterSlice | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CustomWidgets/PrintingWindow.cs b/CustomWidgets/PrintingWindow.cs index bccbe1a44..0d164af48 100644 --- a/CustomWidgets/PrintingWindow.cs +++ b/CustomWidgets/PrintingWindow.cs @@ -68,8 +68,8 @@ namespace MatterHackers.MatterControl.CustomWidgets progressBar.RatioComplete = targetValue != 0 ? actualValue / targetValue : 1; - this.actualTemp.Text = $"{actualValue:0.#}°"; - this.targetTemp.Text = $"{targetValue:0.#}°"; + this.actualTemp.Text = $"{actualValue:0}°"; + this.targetTemp.Text = $"{targetValue:0}°"; } } @@ -95,8 +95,8 @@ namespace MatterHackers.MatterControl.CustomWidgets progressBar.RatioComplete = targetValue != 0 ? actualValue / targetValue : 1; - this.actualTemp.Text = $"{actualValue:0.#}°"; - this.targetTemp.Text = $"{targetValue:0.#}°"; + this.actualTemp.Text = $"{actualValue:0}°"; + this.targetTemp.Text = $"{targetValue:0}°"; } } diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index 2554b06f1..5f1a8da09 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit 2554b06f10df85926c35ec018d450f2a4cece199 +Subproject commit 5f1a8da0909640654d4faf953d5efd73d121ea82 From 382d8cd69094e53b381d1de2c978710c3ffbae0f Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Fri, 24 Feb 2017 13:29:10 -0800 Subject: [PATCH 2/3] Made the numbers padded with a FIGURE SPACE. --- CustomWidgets/PrintingWindow.cs | 16 ++++++++++------ Submodules/agg-sharp | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CustomWidgets/PrintingWindow.cs b/CustomWidgets/PrintingWindow.cs index 0d164af48..44d5a2d71 100644 --- a/CustomWidgets/PrintingWindow.cs +++ b/CustomWidgets/PrintingWindow.cs @@ -64,12 +64,14 @@ namespace MatterHackers.MatterControl.CustomWidgets public override void UpdateTemperatures() { double targetValue = PrinterConnectionAndCommunication.Instance.TargetBedTemperature; - double actualValue = PrinterConnectionAndCommunication.Instance.ActualBedTemperature; + double actualValue = Math.Max(0, PrinterConnectionAndCommunication.Instance.ActualBedTemperature); progressBar.RatioComplete = targetValue != 0 ? actualValue / targetValue : 1; - this.actualTemp.Text = $"{actualValue:0}°"; - this.targetTemp.Text = $"{targetValue:0}°"; + var actual = $"{actualValue:0}"; + this.actualTemp.Text = actual.PadLeft(Math.Max(0, 4 - actual.Length), ' ') + "°"; // put in padding spaces to make it at least 3 characters + var target = $"{targetValue:0}"; + this.targetTemp.Text = target.PadLeft(Math.Max(0, 4 - target.Length), ' ') + "°"; // put in padding spaces to make it at least 3 characters } } @@ -91,12 +93,14 @@ namespace MatterHackers.MatterControl.CustomWidgets public override void UpdateTemperatures() { double targetValue = PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex); - double actualValue = PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderIndex); + double actualValue = Math.Max(0, PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderIndex)); progressBar.RatioComplete = targetValue != 0 ? actualValue / targetValue : 1; - this.actualTemp.Text = $"{actualValue:0}°"; - this.targetTemp.Text = $"{targetValue:0}°"; + var actual = $"{actualValue:0}"; + this.actualTemp.Text = actual.PadLeft(Math.Max(0, 4 - actual.Length), ' ') + "°"; // put in padding spaces to make it at least 3 characters + var target = $"{targetValue:0}"; + this.targetTemp.Text = target.PadLeft(Math.Max(0, 4 - target.Length), ' ') + "°"; // put in padding spaces to make it at least 3 characters } } diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 5ce6224fe..5456a59e4 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 5ce6224fed7caf5d6c2faf5d409f758c80c46118 +Subproject commit 5456a59e4c2b96d858be28f9b60baa7a45466f0c From 067527035bc0ab73bb2a41ea73a0cd05d20c0d29 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Fri, 24 Feb 2017 14:10:12 -0800 Subject: [PATCH 3/3] Better understanding of padleft --- CustomWidgets/PrintingWindow.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CustomWidgets/PrintingWindow.cs b/CustomWidgets/PrintingWindow.cs index 44d5a2d71..df4f554e0 100644 --- a/CustomWidgets/PrintingWindow.cs +++ b/CustomWidgets/PrintingWindow.cs @@ -68,10 +68,8 @@ namespace MatterHackers.MatterControl.CustomWidgets progressBar.RatioComplete = targetValue != 0 ? actualValue / targetValue : 1; - var actual = $"{actualValue:0}"; - this.actualTemp.Text = actual.PadLeft(Math.Max(0, 4 - actual.Length), ' ') + "°"; // put in padding spaces to make it at least 3 characters - var target = $"{targetValue:0}"; - this.targetTemp.Text = target.PadLeft(Math.Max(0, 4 - target.Length), ' ') + "°"; // put in padding spaces to make it at least 3 characters + this.actualTemp.Text = $"{actualValue:0}".PadLeft(3, (char)0x2007) + "°"; // put in padding spaces to make it at least 3 characters + this.targetTemp.Text = $"{targetValue:0}".PadLeft(3, (char)0x2007) + "°"; // put in padding spaces to make it at least 3 characters } } @@ -97,10 +95,8 @@ namespace MatterHackers.MatterControl.CustomWidgets progressBar.RatioComplete = targetValue != 0 ? actualValue / targetValue : 1; - var actual = $"{actualValue:0}"; - this.actualTemp.Text = actual.PadLeft(Math.Max(0, 4 - actual.Length), ' ') + "°"; // put in padding spaces to make it at least 3 characters - var target = $"{targetValue:0}"; - this.targetTemp.Text = target.PadLeft(Math.Max(0, 4 - target.Length), ' ') + "°"; // put in padding spaces to make it at least 3 characters + this.actualTemp.Text = $"{actualValue:0}".PadLeft(3, (char)0x2007) + "°"; // put in padding spaces to make it at least 3 characters + this.targetTemp.Text = $"{targetValue:0}".PadLeft(3, (char)0x2007) + "°"; // put in padding spaces to make it at least 3 characters } }