Merge pull request #4608 from jlewin/master

Reduce layer count on XY calibration template
This commit is contained in:
johnlewin 2019-06-12 10:05:51 -07:00 committed by GitHub
commit 3da1bfb930
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 58 additions and 31 deletions

View file

@ -250,25 +250,26 @@ namespace MatterHackers.MatterControl
private static async Task<IObject3D> CreateCalibrationObject(PrinterConfig printer, XyCalibrationWizard calibrationWizard) private static async Task<IObject3D> CreateCalibrationObject(PrinterConfig printer, XyCalibrationWizard calibrationWizard)
{ {
var layerHeight = printer.Settings.GetValue<double>(SettingsKey.layer_height); var layerHeight = printer.Settings.GetValue<double>(SettingsKey.layer_height);
var firstLayerHeight = printer.Settings.GetValue<double>(SettingsKey.first_layer_height);
switch (calibrationWizard.Quality) switch (calibrationWizard.Quality)
{ {
case QualityType.Coarse: case QualityType.Coarse:
return await XyCalibrationTabObject3D.Create( return await XyCalibrationTabObject3D.Create(
1, 1,
Math.Max(printer.Settings.GetValue<double>(SettingsKey.first_layer_height) * 2, layerHeight * 2), Math.Max(firstLayerHeight * 2, layerHeight * 2),
calibrationWizard.Offset, calibrationWizard.Offset,
printer.Settings.GetValue<double>(SettingsKey.nozzle_diameter)); printer.Settings.GetValue<double>(SettingsKey.nozzle_diameter));
default: default:
return await XyCalibrationFaceObject3D.Create( return await XyCalibrationFaceObject3D.Create(
1, 1,
printer.Settings.GetValue<double>(SettingsKey.first_layer_height) + layerHeight, firstLayerHeight + layerHeight,
layerHeight, layerHeight,
calibrationWizard.Offset, calibrationWizard.Offset,
printer.Settings.GetValue<double>(SettingsKey.nozzle_diameter), printer.Settings.GetValue<double>(SettingsKey.nozzle_diameter),
printer.Settings.GetValue<double>(SettingsKey.wipe_tower_size), printer.Settings.GetValue<double>(SettingsKey.wipe_tower_size),
6); 4);
} }
} }
} }

View file

@ -216,34 +216,37 @@ namespace MatterHackers.MatterControl.DesignTools
private static FlowLayoutWidget CreateSettingsColumn(string labelText, UIField field, string toolTipText = null) private static FlowLayoutWidget CreateSettingsColumn(string labelText, UIField field, string toolTipText = null)
{ {
var column = CreateSettingsColumn(labelText, toolTipText);
var row = new FlowLayoutWidget() var row = new FlowLayoutWidget()
{ {
HAnchor = HAnchor.Stretch HAnchor = HAnchor.Stretch
}; };
row.AddChild(new HorizontalSpacer()); row.AddChild(new HorizontalSpacer());
row.AddChild(field.Content); row.AddChild(field.Content);
var column = CreateSettingsColumn(labelText, toolTipText);
column.AddChild(row); column.AddChild(row);
return column; return column;
} }
private static FlowLayoutWidget CreateSettingsColumn(string labelText, string toolTipText = null) private static FlowLayoutWidget CreateSettingsColumn(string labelText, string toolTipText = null)
{ {
var columnContainer = new FlowLayoutWidget(FlowDirection.TopToBottom) var theme = AppContext.Theme;
var column = new FlowLayoutWidget(FlowDirection.TopToBottom)
{ {
HAnchor = HAnchor.Stretch, HAnchor = HAnchor.Stretch,
Padding = new BorderDouble(5), Padding = new BorderDouble(9, 5, 5, 5), // Use hard-coded 9 pixel left margin to match SettingsRow
ToolTipText = toolTipText ToolTipText = toolTipText
}; };
var label = new TextWidget(labelText + ":", pointSize: 11, textColor: AppContext.Theme.TextColor) var label = SettingsRow.CreateSettingsLabel(labelText, toolTipText, theme.TextColor);
{ label.VAnchor = VAnchor.Absolute;
Margin = new BorderDouble(0, 3, 0, 0), label.HAnchor = HAnchor.Left;
HAnchor = HAnchor.Left
};
columnContainer.AddChild(label);
return columnContainer; column.AddChild(label);
return column;
} }
public static IEnumerable<EditableProperty> GetEditablePropreties(IObject3D item) public static IEnumerable<EditableProperty> GetEditablePropreties(IObject3D item)
@ -387,14 +390,13 @@ namespace MatterHackers.MatterControl.DesignTools
else if (propertyValue is DirectionAxis directionAxis) else if (propertyValue is DirectionAxis directionAxis)
{ {
rowContainer = CreateSettingsColumn(property); rowContainer = CreateSettingsColumn(property);
var newDirectionVector = new DirectionVector()
{
Normal = directionAxis.Normal
};
var field1 = new DirectionVectorField(theme); var field1 = new DirectionVectorField(theme);
field1.Initialize(0); field1.Initialize(0);
field1.SetValue(newDirectionVector); field1.SetValue(new DirectionVector()
{
Normal = directionAxis.Normal
});
rowContainer.AddChild(new SettingsRow("Axis".Localize(), null, field1.Content, theme)); rowContainer.AddChild(new SettingsRow("Axis".Localize(), null, field1.Content, theme));
@ -404,7 +406,8 @@ namespace MatterHackers.MatterControl.DesignTools
var field2 = new Vector3Field(theme); var field2 = new Vector3Field(theme);
field2.Initialize(0); field2.Initialize(0);
field2.Vector3 = directionAxis.Origin - property.Item.Children.First().GetAxisAlignedBoundingBox().Center; field2.Vector3 = directionAxis.Origin - property.Item.Children.First().GetAxisAlignedBoundingBox().Center;
var row2 = CreateSettingsColumn("Offset", field2);
var row2 = CreateSettingsColumn("Offset".Localize(), field2);
// update this when changed // update this when changed
void UpdateData(object s, InvalidateArgs e) void UpdateData(object s, InvalidateArgs e)

View file

@ -93,6 +93,9 @@ namespace MatterHackers.MatterControl.PrintLibrary
}; };
theme.ApplyBoxStyle(nameSection); theme.ApplyBoxStyle(nameSection);
// Reset right margin
nameSection.Margin = nameSection.Margin.Clone(right: theme.DefaultContainerPadding);
printerInfo = new FlowLayoutWidget() printerInfo = new FlowLayoutWidget()
{ {
HAnchor = HAnchor.Stretch, HAnchor = HAnchor.Stretch,
@ -100,7 +103,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
}; };
nameSection.BackgroundColor = theme.MinimalShade; nameSection.BackgroundColor = theme.MinimalShade;
nameSection.Margin = new BorderDouble(top: theme.DefaultContainerPadding); nameSection.Margin = new BorderDouble(theme.DefaultContainerPadding).Clone(left: 0);
var panel2Column = new FlowLayoutWidget(FlowDirection.TopToBottom) var panel2Column = new FlowLayoutWidget(FlowDirection.TopToBottom)
{ {
@ -117,7 +120,22 @@ namespace MatterHackers.MatterControl.PrintLibrary
Margin = new BorderDouble(top: 3) Margin = new BorderDouble(top: 3)
}); });
panel2Column.AddChild(printerInfo); var scrollable = new ScrollableWidget(autoScroll: true)
{
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Stretch,
};
scrollable.ScrollArea.HAnchor = HAnchor.Stretch;
// Padding allows space for scrollbar
printerInfo.Padding = new BorderDouble(right: theme.DefaultContainerPadding + 2);
scrollable.AddChild(printerInfo);
panel2Column.AddChild(scrollable);
horizontalSplitter.Panel2.Padding = horizontalSplitter.Panel2.Padding.Clone(right: 0, bottom: 0);
horizontalSplitter.Panel2.AddChild(panel2Column); horizontalSplitter.Panel2.AddChild(panel2Column);
@ -316,6 +334,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
false) false)
{ {
ShowProducts = false, ShowProducts = false,
ShowHeadingRow = false,
StoreID = storePrinterID?.SID, StoreID = storePrinterID?.SID,
HAnchor = HAnchor.Stretch, HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Fit VAnchor = VAnchor.Fit

View file

@ -1,5 +1,5 @@
/* /*
Copyright (c) 2018, John Lewin Copyright (c) 2019, John Lewin
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
@ -28,6 +28,9 @@ either expressed or implied, of the FreeBSD Project.
*/ */
using System;
using System.Diagnostics;
using System.IO;
using Markdig.Agg; using Markdig.Agg;
using MatterHackers.Agg; using MatterHackers.Agg;
using MatterHackers.Agg.Image; using MatterHackers.Agg.Image;
@ -39,30 +42,23 @@ using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.SettingsManagement; using MatterHackers.MatterControl.SettingsManagement;
using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.MatterControl.SlicerConfiguration;
using Newtonsoft.Json; using Newtonsoft.Json;
using System;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
{ {
public class PrinterDetails : FlowLayoutWidget public class PrinterDetails : FlowLayoutWidget
{ {
private ThemeConfig theme; private ThemeConfig theme;
private GuiWidget headingRow;
private PrinterInfo printerInfo; private PrinterInfo printerInfo;
private FlowLayoutWidget productDataContainer; private FlowLayoutWidget productDataContainer;
public bool ShowProducts { get; set; } = true;
public PrinterDetails(PrinterInfo printerInfo, ThemeConfig theme, bool showOpenButton) public PrinterDetails(PrinterInfo printerInfo, ThemeConfig theme, bool showOpenButton)
: base(FlowDirection.TopToBottom) : base(FlowDirection.TopToBottom)
{ {
this.printerInfo = printerInfo; this.printerInfo = printerInfo;
this.theme = theme; this.theme = theme;
var headingRow = this.AddHeading( headingRow = this.AddHeading(
OemSettings.Instance.GetIcon(printerInfo.Make), OemSettings.Instance.GetIcon(printerInfo.Make),
printerInfo.Name); printerInfo.Name);
@ -87,6 +83,10 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
public string StoreID { get; set; } public string StoreID { get; set; }
public bool ShowHeadingRow { get; set; } = true;
public bool ShowProducts { get; set; } = true;
public override async void OnLoad(EventArgs args) public override async void OnLoad(EventArgs args)
{ {
if (string.IsNullOrEmpty(this.StoreID) if (string.IsNullOrEmpty(this.StoreID)
@ -130,6 +130,8 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
}); });
} }
headingRow.Visible = this.ShowHeadingRow;
base.OnLoad(args); base.OnLoad(args);
} }

View file

@ -69,6 +69,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
if (userIsLoggedIn) if (userIsLoggedIn)
{ {
contentRow.AddChild(printerPanel); contentRow.AddChild(printerPanel);
contentRow.Padding = 0;
} }
else else
{ {

View file

@ -47,6 +47,7 @@ namespace MatterHackers.MatterControl
public HelpTreePanel(ThemeConfig theme, string guideKey = null) public HelpTreePanel(ThemeConfig theme, string guideKey = null)
: base(theme) : base(theme)
{ {
this.ChildBorderColor = theme.BorderColor40;
AddGuides(); AddGuides();
CreateMousePage(); CreateMousePage();
CreateKeyBindingsPage(); CreateKeyBindingsPage();