public static bool SetupRequired(PrinterConfig printer, bool requiresLoadedFilament) { return(printer == null || LevelingValidation.NeedsToBeRun(printer) || // PrintLevelingWizard ZCalibrationWizard.NeedsToBeRun(printer) || (requiresLoadedFilament && LoadFilamentWizard.NeedsToBeRun0(printer)) || (requiresLoadedFilament && LoadFilamentWizard.NeedsToBeRun1(printer)) || XyCalibrationWizard.NeedsToBeRun(printer)); }
public static bool SetupRequired(PrinterConfig printer, bool requiresLoadedFilament) { // TODO: Verify invoked with low frequency var printerShim = ApplicationController.Instance.Shim(printer); return(LevelingValidation.NeedsToBeRun(printerShim) || // PrintLevelingWizard ZCalibrationWizard.NeedsToBeRun(printer) || (requiresLoadedFilament && LoadFilamentWizard.NeedsToBeRun0(printer)) || (requiresLoadedFilament && LoadFilamentWizard.NeedsToBeRun1(printer)) || XyCalibrationWizard.NeedsToBeRun(printer)); }
protected void SetButtonStates() { // If we don't have leveling data and we need it bool showSetupButton = PrintLevelingData.NeedsToBeRun(printer) || ProbeCalibrationWizard.NeedsToBeRun(printer) || LoadFilamentWizard.NeedsToBeRun(printer); switch (printer.Connection.CommunicationState) { case CommunicationStates.FinishedPrint: case CommunicationStates.Connected: if (showSetupButton) { startPrintButton.Visible = false; finishSetupButton.Visible = true; finishSetupButton.Enabled = true; theme.ApplyPrimaryActionStyle(finishSetupButton); } else { startPrintButton.Visible = true; startPrintButton.Enabled = true; finishSetupButton.Visible = false; theme.ApplyPrimaryActionStyle(startPrintButton); } break; case CommunicationStates.PrintingFromSd: case CommunicationStates.Printing: case CommunicationStates.Paused: default: if (showSetupButton) { startPrintButton.Visible = false; finishSetupButton.Visible = true; finishSetupButton.Enabled = false; theme.RemovePrimaryActionStyle(finishSetupButton); } else { startPrintButton.Visible = true; startPrintButton.Enabled = false; finishSetupButton.Visible = false; theme.RemovePrimaryActionStyle(startPrintButton); } break; } }
internal ControlContentExtruder(PrinterConfig printer, int extruderIndex, ThemeConfig theme) : base(FlowDirection.TopToBottom) { this.HAnchor = HAnchor.Stretch; this.printer = printer; GuiWidget loadUnloadButtons = null; // We do not yet support loading filament into extruders other than 0, fix it when time. if (extruderIndex == 0) { // add in load and unload buttons loadUnloadButtons = new FlowLayoutWidget() { Padding = theme.ToolbarPadding, }; var loadButton = theme.CreateDialogButton("Load".Localize()); loadButton.ToolTipText = "Load filament".Localize(); loadButton.Name = "Load Filament Button"; loadButton.Click += (s, e) => { UiThread.RunOnIdle(() => { LoadFilamentWizard.Start(printer, theme, true); }); }; loadUnloadButtons.AddChild(loadButton); var unloadButton = theme.CreateDialogButton("Unload".Localize()); unloadButton.ToolTipText = "Unload filament".Localize(); unloadButton.Click += (s, e) => { UiThread.RunOnIdle(() => { UnloadFilamentWizard.Start(printer, theme, true); }); }; loadUnloadButtons.AddChild(unloadButton); this.AddChild(new SettingsItem("Filament".Localize(), loadUnloadButtons, theme, enforceGutter: false)); } // Add the Extrude buttons var buttonContainer = new FlowLayoutWidget() { HAnchor = HAnchor.Fit, VAnchor = VAnchor.Fit, Padding = theme.ToolbarPadding, }; int extruderButtonTopMargin = loadUnloadButtons == null ? 8 : 0; var extrudeButton = theme.CreateDialogButton("Extrude".Localize()); extrudeButton.Name = "Extrude Button"; extrudeButton.ToolTipText = "Extrude filament".Localize(); extrudeButton.Click += (s, e) => { printer.Connection.MoveExtruderRelative(moveAmount, printer.Settings.EFeedRate(extruderIndex), extruderIndex); }; buttonContainer.AddChild(extrudeButton); var retractButton = theme.CreateDialogButton("Retract".Localize()); retractButton.ToolTipText = "Retract filament".Localize(); retractButton.Click += (s, e) => { printer.Connection.MoveExtruderRelative(moveAmount * -1, printer.Settings.EFeedRate(extruderIndex), extruderIndex); }; buttonContainer.AddChild(retractButton); this.AddChild(new SettingsItem( loadUnloadButtons == null ? "Filament".Localize() : "", // Don't put the name if we put in a load and unload button (it has the name) buttonContainer, theme, enforceGutter: false)); var moveButtonsContainer = new FlowLayoutWidget() { VAnchor = VAnchor.Fit | VAnchor.Center, HAnchor = HAnchor.Fit, Padding = theme.ToolbarPadding, }; var oneButton = theme.CreateMicroRadioButton("1"); oneButton.CheckedStateChanged += (s, e) => { if (oneButton.Checked) { moveAmount = 1; } }; moveButtonsContainer.AddChild(oneButton); var tenButton = theme.CreateMicroRadioButton("10"); tenButton.CheckedStateChanged += (s, e) => { if (tenButton.Checked) { moveAmount = 10; } }; moveButtonsContainer.AddChild(tenButton); var oneHundredButton = theme.CreateMicroRadioButton("100"); oneHundredButton.CheckedStateChanged += (s, e) => { if (oneHundredButton.Checked) { moveAmount = 100; } }; moveButtonsContainer.AddChild(oneHundredButton); switch (moveAmount) { case 1: oneButton.Checked = true; break; case 10: tenButton.Checked = true; break; case 100: oneHundredButton.Checked = true; break; } moveButtonsContainer.AddChild(new TextWidget("mm", textColor: theme.TextColor, pointSize: 8) { VAnchor = VAnchor.Center, Margin = new BorderDouble(3, 0) }); this.AddChild(new SettingsItem("Distance".Localize(), moveButtonsContainer, theme, enforceGutter: false)); }