From fca740e4659ee9dd67d8a5f646dd80834b517b77 Mon Sep 17 00:00:00 2001 From: jlewin Date: Tue, 4 Jun 2019 17:34:22 -0700 Subject: [PATCH] Consolidate export button code --- .../View3D/PrinterBar/PrintPopupMenu.cs | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs b/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs index d5d9fe062..10c617dfb 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/PrinterBar/PrintPopupMenu.cs @@ -196,6 +196,24 @@ namespace MatterHackers.MatterControl.PartPreviewWindow this.CloseMenu(); }; + var hasErrors = errors.Any(e => e.ErrorLevel == ValidationErrorLevel.Error); + var hasWarnings = errors.Any(e => e.ErrorLevel == ValidationErrorLevel.Warning + && UserSettings.Instance.get($"Ignore_{e.ID}") != "true"); + + var hasErrorsOrWarnings = hasErrors || hasWarnings; + if (hasErrorsOrWarnings) + { + string label = hasErrors ? "Action Required".Localize() : "Action Recommended".Localize(); + + setupRow.AddChild(new TextWidget(label, textColor: hasErrors ? Color.Red : theme.PrimaryAccentColor, pointSize: theme.DefaultFontSize) + { + VAnchor = VAnchor.Bottom, + AutoExpandBoundsToText = true, + }); + } + + setupRow.AddChild(new HorizontalSpacer()); + GCodeExport exportPlugin = null; bool isSailfish = printer.Settings.GetValue("enable_sailfish_communication"); @@ -235,24 +253,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow exportPlugin); }; - var hasErrors = errors.Any(e => e.ErrorLevel == ValidationErrorLevel.Error); - var hasWarnings = errors.Any(e => e.ErrorLevel == ValidationErrorLevel.Warning - && UserSettings.Instance.get($"Ignore_{e.ID}") != "true"); - - var hasErrorsOrWarnings = hasErrors || hasWarnings; - if (hasErrorsOrWarnings) - { - string label = hasErrors ? "Action Required".Localize() : "Action Recommended".Localize(); - - setupRow.AddChild(new TextWidget(label, textColor: hasErrors ? Color.Red : theme.PrimaryAccentColor, pointSize: theme.DefaultFontSize) - { - VAnchor = VAnchor.Bottom, - AutoExpandBoundsToText = true, - }); - } - - setupRow.AddChild(new HorizontalSpacer()); setupRow.AddChild(exportGCodeButton); + setupRow.AddChild(startPrintButton); printPanel.AddChild(setupRow);