Merge pull request #3354 from jlewin/design_tools

Ignore "Start Print" on empty bed
This commit is contained in:
johnlewin 2018-05-25 07:21:53 -07:00 committed by GitHub
commit b7d834304d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 32 additions and 14 deletions

View file

@ -71,12 +71,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
// check that the bed temperature at probe time was close enough to the current print bed temp
double reqiredLevlingTemp = printer.Settings.GetValue<bool>(SettingsKey.has_heated_bed) ?
double requiredLevelingTemp = printer.Settings.GetValue<bool>(SettingsKey.has_heated_bed) ?
printer.Settings.GetValue<double>(SettingsKey.bed_temperature)
: 0;
// check that it is within 10 degrees
if(Math.Abs(reqiredLevlingTemp - levelingData.BedTemperature) > 10)
if(Math.Abs(requiredLevelingTemp - levelingData.BedTemperature) > 10)
{
return true;
}

View file

@ -229,7 +229,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
"{0} {1}\n\n{2}\n{3}\n\n{4}",
"Congratulations!".Localize(),
"Print Leveling is now configured and enabled.".Localize(),
useZProbe ? $"\t• {"Remove the paper".Localize()}\n" : "",
useZProbe ? "" : $"\t• {"Remove the paper".Localize()}\n",
"If you need to recalibrate the printer in the future, the print leveling controls can be found under: Controls, Calibration".Localize(),
"Click 'Done' to close this window.".Localize()),
probePositions);

View file

@ -265,6 +265,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
public ChromeTabs TabControl => tabControl;
private ChromeTab CreatePrinterTab(PrinterConfig printer, ThemeConfig theme, string tabTitle)
{
// Printer page is in fixed position

View file

@ -326,20 +326,29 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab
iconButton.Click += async (s, e) =>
{
if (this.PositionWithinLocalBounds(e.X, e.Y)
&& e.Button == MouseButtons.Left)
// Activate selected item tab
if (partPreviewContent.TabControl.AllTabs.FirstOrDefault(t => t.Text == item.Name) is ChromeTab existingItemTab)
{
var workspace = new BedConfig();
await workspace.LoadContent(
new EditContext()
{
ContentStore = ApplicationController.Instance.Library.PartHistory,
SourceItem = item
});
partPreviewContent.TabControl.ActiveTab = existingItemTab;
}
else
{
// Create tab for selected item
if (this.PositionWithinLocalBounds(e.X, e.Y)
&& e.Button == MouseButtons.Left)
{
var workspace = new BedConfig();
await workspace.LoadContent(
new EditContext()
{
ContentStore = ApplicationController.Instance.Library.PartHistory,
SourceItem = item
});
ApplicationController.Instance.Workspaces.Add(workspace);
ApplicationController.Instance.Workspaces.Add(workspace);
partPreviewContent.CreatePartTab(item.Name, workspace, theme);
partPreviewContent.CreatePartTab(item.Name, workspace, theme);
}
}
};

View file

@ -42,6 +42,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public interface ITab
{
GuiWidget TabContent { get; }
string Text { get; }
}
/// <summary>
@ -475,6 +476,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public ChromeTab(string tabLabel, SimpleTabs parentTabControl, GuiWidget tabContent, ThemeConfig theme, ImageBuffer imageBuffer, bool hasClose = true)
: base(tabLabel, parentTabControl, tabContent, theme, iconImage: imageBuffer, hasClose: hasClose)
{
this.Text = tabLabel;
}
private static int tabInsetDistance = 14 / 2;

View file

@ -144,6 +144,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
button.Click += (s, e) =>
{
if (!printer.Bed.Scene.Children.Any())
{
return;
}
UiThread.RunOnIdle(async () =>
{
// Save any pending changes before starting print operation