Starting to collect data at the end of a print
This commit is contained in:
parent
a127b26377
commit
e832522155
10 changed files with 218 additions and 38 deletions
|
|
@ -2238,7 +2238,7 @@ namespace MatterHackers.MatterControl
|
|||
&& !printerConnection.CalibrationPrint)
|
||||
{
|
||||
var printTasks = PrintHistoryData.Instance.GetHistoryItems(10);
|
||||
var printHistoryEditor = new PrintHistoryEditor(AppContext.Theme, printerConnection.ActivePrintTask, printTasks);
|
||||
var printHistoryEditor = new PrintHistoryEditor(AppContext.Theme, printerConnection.CanceledPrintTask, printTasks);
|
||||
printHistoryEditor.CollectInfoPrintCanceled();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace MatterHackers.MatterControl.DesignTools
|
||||
{
|
||||
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
public class MultiLineEditAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -51,7 +51,9 @@ namespace MatterHackers.MatterControl.Library
|
|||
public class Field
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
||||
public string Key { get; set; }
|
||||
|
||||
public string Type { get; set; }
|
||||
}
|
||||
}
|
||||
100
MatterControlLib/DesignTools/OpenSCAD/OpenScadScriptObject3D.cs
Normal file
100
MatterControlLib/DesignTools/OpenSCAD/OpenScadScriptObject3D.cs
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
Copyright (c) 2019, Lars Brubaker, John Lewin
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the FreeBSD Project.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.DataConverters3D;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.DesignTools;
|
||||
|
||||
namespace MatterHackers.MatterControl.Library
|
||||
{
|
||||
public class OpenScadScriptObject3D : Object3D
|
||||
{
|
||||
[MultiLineEditAttribute]
|
||||
public string NameToWrite { get; set; } = "cube([20, 20, 20]);";
|
||||
|
||||
public OpenScadScriptObject3D()
|
||||
{
|
||||
Name = "SCAD Script".Localize();
|
||||
}
|
||||
|
||||
public static async Task<IObject3D> Create()
|
||||
{
|
||||
var item = new OpenScadScriptObject3D();
|
||||
await item.Rebuild();
|
||||
return item;
|
||||
}
|
||||
|
||||
public override async void OnInvalidate(InvalidateArgs invalidateType)
|
||||
{
|
||||
if (invalidateType.InvalidateType.HasFlag(InvalidateType.Properties)
|
||||
&& invalidateType.Source == this)
|
||||
{
|
||||
await Rebuild();
|
||||
}
|
||||
else
|
||||
{
|
||||
base.OnInvalidate(invalidateType);
|
||||
}
|
||||
}
|
||||
|
||||
public override Task Rebuild()
|
||||
{
|
||||
this.DebugDepth("Rebuild");
|
||||
bool valuesChanged = false;
|
||||
using (RebuildLock())
|
||||
{
|
||||
if (Mesh == null)
|
||||
{
|
||||
using (var meshStream = AggContext.StaticData.OpenStream(Path.Combine("Stls", "openscad_logo.stl")))
|
||||
{
|
||||
using (new CenterAndHeightMaintainer(this))
|
||||
{
|
||||
this.Mesh = Object3D.Load(meshStream, ".stl", CancellationToken.None).Mesh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (valuesChanged)
|
||||
{
|
||||
Invalidate(InvalidateType.DisplayValues);
|
||||
}
|
||||
|
||||
Parent?.Invalidate(new InvalidateArgs(this, InvalidateType.Mesh));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -55,13 +55,19 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
|
||||
public double OuterDiameter { get; set; } = 20;
|
||||
|
||||
public double InnerDiameter { get; set; } = 10;
|
||||
|
||||
public int Sides { get; set; } = 40;
|
||||
|
||||
public bool Advanced { get; set; } = false;
|
||||
|
||||
public double StartingAngle { get; set; } = 0;
|
||||
|
||||
public double EndingAngle { get; set; } = 360;
|
||||
|
||||
public int RingSides { get; set; } = 15;
|
||||
|
||||
public int RingPhaseAngle { get; set; } = 0;
|
||||
|
||||
public override async void OnInvalidate(InvalidateArgs invalidateType)
|
||||
|
|
|
|||
|
|
@ -169,26 +169,31 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
|
||||
private static GuiWidget CreateSettingsRow(EditableProperty property, UIField field, ThemeConfig theme)
|
||||
{
|
||||
return new SettingsRow(property.DisplayName.Localize(), property.Description.Localize(), field.Content, theme);
|
||||
return new SettingsRow(property.DisplayName.Localize(), property.Description, field.Content, theme);
|
||||
}
|
||||
|
||||
private static FlowLayoutWidget CreateSettingsColumn(EditableProperty property, UIField field)
|
||||
private static FlowLayoutWidget CreateSettingsColumn(EditableProperty property, UIField field, bool fullWidth = false)
|
||||
{
|
||||
return CreateSettingsColumn(property.DisplayName.Localize(), field, property.Description.Localize());
|
||||
return CreateSettingsColumn(property.DisplayName.Localize(), field, property.Description, fullWidth: fullWidth);
|
||||
}
|
||||
|
||||
private static FlowLayoutWidget CreateSettingsColumn(EditableProperty property)
|
||||
{
|
||||
return CreateSettingsColumn(property.DisplayName.Localize(), property.Description.Localize());
|
||||
return CreateSettingsColumn(property.DisplayName.Localize(), property.Description);
|
||||
}
|
||||
|
||||
private static FlowLayoutWidget CreateSettingsColumn(string labelText, UIField field, string toolTipText = null)
|
||||
private static FlowLayoutWidget CreateSettingsColumn(string labelText, UIField field, string toolTipText = null, bool fullWidth = false)
|
||||
{
|
||||
var row = new FlowLayoutWidget()
|
||||
{
|
||||
HAnchor = HAnchor.Stretch
|
||||
};
|
||||
row.AddChild(new HorizontalSpacer());
|
||||
|
||||
if (!fullWidth)
|
||||
{
|
||||
row.AddChild(new HorizontalSpacer());
|
||||
}
|
||||
|
||||
row.AddChild(field.Content);
|
||||
|
||||
var column = CreateSettingsColumn(labelText, toolTipText);
|
||||
|
|
@ -285,7 +290,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
};
|
||||
|
||||
rowContainer = new SettingsRow(property.DisplayName.Localize(),
|
||||
property.Description.Localize(),
|
||||
property.Description,
|
||||
valueField,
|
||||
theme);
|
||||
|
||||
|
|
@ -525,7 +530,7 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
};
|
||||
|
||||
rowContainer = new SettingsRow(property.DisplayName.Localize(),
|
||||
property.Description.Localize(),
|
||||
property.Description,
|
||||
valueField,
|
||||
theme);
|
||||
|
||||
|
|
@ -593,19 +598,33 @@ namespace MatterHackers.MatterControl.DesignTools
|
|||
}
|
||||
else // normal edit row
|
||||
{
|
||||
// create a string editor
|
||||
var field = new TextField(theme);
|
||||
field.Initialize(0);
|
||||
field.SetValue(stringValue, false);
|
||||
field.ClearUndoHistory();
|
||||
field.Content.HAnchor = HAnchor.Stretch;
|
||||
RegisterValueChanged(field, (valueString) => valueString);
|
||||
rowContainer = CreateSettingsRow(property, field, theme);
|
||||
var multiLineEditAttribute = property.PropertyInfo.GetCustomAttributes(true).OfType<MultiLineEditAttribute>().FirstOrDefault();
|
||||
|
||||
var label = rowContainer.Children.First();
|
||||
|
||||
if (field is TextField)
|
||||
if (multiLineEditAttribute != null)
|
||||
{
|
||||
// create a a multi-line string editor
|
||||
var field = new MultilineStringField(theme);
|
||||
field.Initialize(0);
|
||||
field.SetValue(stringValue, false);
|
||||
field.ClearUndoHistory();
|
||||
field.Content.HAnchor = HAnchor.Stretch;
|
||||
// field.Content.MinimumSize = new Vector2(0, 200 * GuiWidget.DeviceScale);
|
||||
RegisterValueChanged(field, (valueString) => valueString);
|
||||
rowContainer = CreateSettingsColumn(property, field, fullWidth: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create a string editor
|
||||
var field = new TextField(theme);
|
||||
field.Initialize(0);
|
||||
field.SetValue(stringValue, false);
|
||||
field.ClearUndoHistory();
|
||||
field.Content.HAnchor = HAnchor.Stretch;
|
||||
RegisterValueChanged(field, (valueString) => valueString);
|
||||
rowContainer = CreateSettingsRow(property, field, theme);
|
||||
|
||||
var label = rowContainer.Children.First();
|
||||
|
||||
var spacer = rowContainer.Children.OfType<HorizontalSpacer>().FirstOrDefault();
|
||||
spacer.HAnchor = HAnchor.Absolute;
|
||||
spacer.Width = Math.Max(0, 100 - label.Width);
|
||||
|
|
|
|||
|
|
@ -93,10 +93,8 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
};
|
||||
}
|
||||
|
||||
public void AddQualityMenu(PopupMenu popupMenu, Action notesChanged)
|
||||
public static GuiWidget GetQualityWidget(ThemeConfig theme, PrintTask printTask, Action clicked)
|
||||
{
|
||||
var theme = ApplicationController.Instance.MenuTheme;
|
||||
|
||||
var content = new FlowLayoutWidget()
|
||||
{
|
||||
HAnchor = HAnchor.Fit | HAnchor.Stretch
|
||||
|
|
@ -152,18 +150,11 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
printTask.PrintQuality = siblings.IndexOf((GuiWidget)s);
|
||||
printTask.QualityWasSet = true;
|
||||
printTask.Commit();
|
||||
popupMenu.Unfocus();
|
||||
notesChanged();
|
||||
clicked();
|
||||
};
|
||||
}
|
||||
|
||||
var menuItem = new PopupMenu.MenuItem(content, theme)
|
||||
{
|
||||
HAnchor = HAnchor.Fit | HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Fit,
|
||||
HoverColor = Color.Transparent,
|
||||
};
|
||||
popupMenu.AddChild(menuItem);
|
||||
return content;
|
||||
}
|
||||
|
||||
private GuiWidget CreateDefaultOptions(GuiWidget textField)
|
||||
|
|
@ -224,10 +215,12 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
- [Trick, Tips & Support Articles](https://www.matterhackers.com/support#mattercontrol)
|
||||
- [User Forum](https://forums.matterhackers.com/recent)";
|
||||
|
||||
ShowNotification("Congratulations Print Complete".Localize(), markdownText, UserSettingsKey.ShownPrintCompleteMessage);
|
||||
//var details = new CollectPrintDetailsPage(ShowNotification("Print Canceled".Localize(),
|
||||
//markdownText,
|
||||
//UserSettingsKey.ShownPrintCanceledMessage);
|
||||
var details = new CollectPrintDetailsPage("Print Canceled".Localize(),
|
||||
markdownText,
|
||||
UserSettingsKey.ShownPrintCanceledMessage,
|
||||
printTask);
|
||||
|
||||
UiThread.RunOnIdle(() => DialogWindow.Show(details, 0));
|
||||
}
|
||||
|
||||
public void CollectInfoPrintFinished()
|
||||
|
|
@ -294,7 +287,7 @@ Support and tutorials:
|
|||
|
||||
public override string Text { get => textEditWidget.Text; set => textEditWidget.Text = value; }
|
||||
|
||||
public CollectPrintDetailsPage(string windowTitle, string initialValue, string emptyText, string discriptionMarkdown, string linkoutMarkdown)
|
||||
public CollectPrintDetailsPage(string windowTitle, string discriptionMarkdown, string linkoutMarkdown, PrintTask printTask)
|
||||
{
|
||||
this.WindowTitle = windowTitle;
|
||||
this.HeaderText = windowTitle;
|
||||
|
|
@ -305,7 +298,13 @@ Support and tutorials:
|
|||
Markdown = discriptionMarkdown,
|
||||
});
|
||||
|
||||
contentRow.AddChild(PrintHistoryEditor.GetQualityWidget(theme, printTask, () =>
|
||||
{
|
||||
}));
|
||||
|
||||
// Adds text box and check box to the above container
|
||||
var emptyText = "Enter Note Here".Localize();
|
||||
var initialValue = printTask.Note == null ? "" : printTask.Note;
|
||||
textEditWidget = new MHTextEditWidget(initialValue, theme, pixelWidth: 300, messageWhenEmptyAndNotSelected: emptyText);
|
||||
textEditWidget.Name = "InputBoxPage TextEditWidget";
|
||||
textEditWidget.HAnchor = HAnchor.Stretch;
|
||||
|
|
|
|||
|
|
@ -243,12 +243,21 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
|
||||
var popupMenu = new PopupMenu(theme);
|
||||
var printHistoryEditor = new PrintHistoryEditor(theme, printTask, printTasks);
|
||||
printHistoryEditor.AddQualityMenu(popupMenu, () =>
|
||||
var qualityWidget = PrintHistoryEditor.GetQualityWidget(theme, printTask, () =>
|
||||
{
|
||||
popupMenu.Unfocus();
|
||||
printInfoWidget.Text = GetPrintInfo();
|
||||
SetIndicatorColor();
|
||||
});
|
||||
|
||||
var menuItem = new PopupMenu.MenuItem(qualityWidget, theme)
|
||||
{
|
||||
HAnchor = HAnchor.Fit | HAnchor.Stretch,
|
||||
VAnchor = VAnchor.Fit,
|
||||
HoverColor = Color.Transparent,
|
||||
};
|
||||
popupMenu.AddChild(menuItem);
|
||||
|
||||
printHistoryEditor.AddNotesMenu(popupMenu, printTasks, () =>
|
||||
{
|
||||
printInfoWidget.Text = GetPrintInfo();
|
||||
|
|
|
|||
|
|
@ -112,6 +112,10 @@ namespace MatterHackers.MatterControl.Library
|
|||
() => "XY Calibration".Localize(),
|
||||
async () => await XyCalibrationFaceObject3D.Create())
|
||||
{ DateCreated = new System.DateTime(index++) },
|
||||
new GeneratorItem(
|
||||
() => "SCAD Script".Localize(),
|
||||
async () => await OpenScadScriptObject3D.Create())
|
||||
{ DateCreated = new System.DateTime(index++) },
|
||||
#endif
|
||||
new GeneratorItem(
|
||||
() => "Image Converter".Localize(),
|
||||
|
|
|
|||
|
|
@ -2274,6 +2274,7 @@ Make sure that your printer is turned on. Some printers will appear to be connec
|
|||
}
|
||||
|
||||
// no matter what we no longer have a print task
|
||||
CanceledPrintTask = ActivePrintTask;
|
||||
ActivePrintTask = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -2782,6 +2783,7 @@ Make sure that your printer is turned on. Some printers will appear to be connec
|
|||
}
|
||||
}
|
||||
|
||||
public PrintTask CanceledPrintTask { get; private set; }
|
||||
public PrintTask ActivePrintTask { get; set; }
|
||||
|
||||
public ExtrusionMultiplierStream ExtrusionMultiplierStream { get; private set; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue