Suppress invalid Save dialog, disable Slice on stand-alone GCODE files
- Wire up listeners to keep button states in sync with content
This commit is contained in:
parent
b11dbf2d2c
commit
c8c938f562
4 changed files with 26 additions and 4 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -56,10 +56,21 @@ 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)
|
||||
{
|
||||
// Slicing disabled when loaded content is stand-alone GCODE file
|
||||
if (printer.Bed.EditContext.IsGGCodeSource)
|
||||
{
|
||||
this.Enabled = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async void OnClick(MouseEventArgs mouseEvent)
|
||||
{
|
||||
base.OnClick(mouseEvent);
|
||||
|
|
@ -70,6 +81,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
// Unregister listeners
|
||||
printer.Connection.CommunicationStateChanged -= Connection_CommunicationStateChanged;
|
||||
printer.Bed.SceneLoaded -= Scene_Loaded;
|
||||
|
||||
base.OnClosed(e);
|
||||
}
|
||||
|
|
@ -81,6 +93,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:
|
||||
|
|
|
|||
|
|
@ -2163,7 +2163,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
sceneContext.Scene.UndoBuffer.ClearHistory();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
this.SelectAll();
|
||||
SceneActions.DeleteSelection(Scene);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 2cfd64bdeacd33f5be83556f54757b15101af146
|
||||
Subproject commit ae83bc8ff30bc77e0cc3c2596beeda0c560d5e36
|
||||
Loading…
Add table
Add a link
Reference in a new issue