Merge remote-tracking branch 'jlewin/issue/5248'

This commit is contained in:
Lars Brubaker 2022-09-06 15:35:47 -07:00
commit 8f4acc7641
4 changed files with 23 additions and 4 deletions

View file

@ -763,7 +763,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
bottomRow.AddChild(timeContainer);
// we can only reslice on 64 bit, because in 64 bit we always have the gcode loaded
if (IntPtr.Size == 8 || ApplicationController.Instance.Allow32BitReSlice)
if ((IntPtr.Size == 8 || ApplicationController.Instance.Allow32BitReSlice)
// Reslice is not applicable on standalone gcode files
&& !printer.Bed.EditContext.FreezeGCode)
{
var resliceButton = new ThemedTextButton("Re-Slice", theme)
{

View file

@ -335,8 +335,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
UiThread.RunOnIdle(async () =>
{
// Save any pending changes before starting print operation
await ApplicationController.Instance.Tasks.Execute("Saving Changes".Localize(), printer, printer.Bed.SaveChanges);
// For non-gcode files, save pending changes before starting print operation
if (!printer.Bed.EditContext.IsGGCodeSource)
{
await ApplicationController.Instance.Tasks.Execute("Saving Changes".Localize(), printer, printer.Bed.SaveChanges);
}
await ApplicationController.Instance.PrintPart(
printer.Bed.EditContext,

View file

@ -56,10 +56,16 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// Register listeners
printer.Connection.CommunicationStateChanged += Connection_CommunicationStateChanged;
printer.Bed.SceneLoaded += Scene_Loaded;
SetButtonStates();
}
private void Scene_Loaded(object sender, EventArgs e)
{
this.SetButtonStates();
}
protected override async void OnClick(MouseEventArgs mouseEvent)
{
base.OnClick(mouseEvent);
@ -70,6 +76,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
// Unregister listeners
printer.Connection.CommunicationStateChanged -= Connection_CommunicationStateChanged;
printer.Bed.SceneLoaded -= Scene_Loaded;
base.OnClosed(e);
}
@ -81,6 +88,13 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private void SetButtonStates()
{
// Slicing disabled when loaded content is stand-alone GCODE file
if (printer.Bed.EditContext.IsGGCodeSource)
{
this.Enabled = false;
return;
}
switch (printer.Connection.CommunicationState)
{
case CommunicationStates.PreparingToPrint:

View file

@ -2166,7 +2166,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
sceneContext.Scene.UndoBuffer.ClearHistory();
}
else
{
{
this.SelectAll();
SceneActions.DeleteSelection(Scene);
}