Merge pull request #890 from larsbrubaker/master

Took out the move to print leveling settings
This commit is contained in:
Lars Brubaker 2016-06-08 12:12:54 -07:00
commit e422ec3ea0
5 changed files with 9 additions and 32 deletions

View file

@ -252,10 +252,6 @@ namespace MatterHackers.MatterControl.ActionBar
autoLevelButton.Margin = new Agg.BorderDouble(top: 3);
autoLevelButton.ToolTipText = "Print leveling is enabled.".Localize();
autoLevelButton.Cursor = Cursors.Hand;
autoLevelButton.Click += (s, e) =>
{
UiNavigation.GoToPrintLevelSettings();
};
autoLevelButton.Visible = ActiveSliceSettings.Instance.DoPrintLeveling();
ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((sender, e) =>

View file

@ -254,6 +254,9 @@ namespace MatterHackers.MatterControl
{
globalInstance.MainView = new DesktopView();
}
ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s, e) => ApplicationController.Instance.ReloadAll(null, null), ref globalInstance.unregisterEvents);
}
}
return globalInstance;

View file

@ -68,9 +68,6 @@ namespace MatterHackers.MatterControl
BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
Padding = new BorderDouble(4);
// TODO: This hooks seems to invalidate most of the other ActivePrinterChanged subscribers as this destroys and recreates everything
ActiveSliceSettings.ActivePrinterChanged.RegisterEvent((s, e) => ApplicationController.Instance.ReloadAll(null, null), ref unregisterEvents);
PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
ApplicationController.Instance.ReloadAdvancedControlsPanelTrigger.RegisterEvent((s, e) => UiThread.RunOnIdle(ReloadAdvancedControlsPanel), ref unregisterEvents);
this.BoundsChanged += onBoundsChanges;

View file

@ -105,27 +105,6 @@ namespace MatterHackers.MatterControl
}
}
public static void GoToPrintLevelSettings()
{
Task.Run(() =>
{
AutomationRunner testRunner = new AutomationRunner(inputType: AutomationRunner.InputType.Simulated, drawSimulatedMouse: false);
testRunner.TimeToMoveMouse = 0;
testRunner.UpDelaySeconds = 0;
if (testRunner.NameExists("SettingsAndControls"))
{
testRunner.ClickByName("SettingsAndControls", 5);
testRunner.Wait(.2);
}
testRunner.ClickByName("Options Tab", .2);
HighlightWidget(testRunner, "AutoLevelRowItem");
testRunner.Dispose();
});
}
private static void HighlightWidget(AutomationRunner testRunner, string widgetNameToHighlight)
{
SystemWindow containingWindow;

View file

@ -75,8 +75,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
BedSettings.SetMakeAndModel(activeInstance.Make, activeInstance.Model);
}
SwitchToPrinterThemeWithoutReloadEvent();
SwitchToPrinterTheme(MatterControlApplication.IsLoading);
if (!MatterControlApplication.IsLoading)
{
OnActivePrinterChanged(null);
@ -90,7 +89,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
/// allows the theme state to be updated before the ActivePrinterChanged event fires, resulting in a single ReloadAll
/// occurring rather than two
/// </summary>
public static void SwitchToPrinterThemeWithoutReloadEvent()
public static void SwitchToPrinterTheme(bool doReloadEvent)
{
int defaultThemeIndex = 1;
@ -103,7 +102,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
themeIndex = defaultThemeIndex;
}
ActiveTheme.SuspendEvents();
if (!doReloadEvent)
{
ActiveTheme.SuspendEvents();
}
ActiveTheme.Instance = ActiveTheme.AvailableThemes[themeIndex];
ActiveTheme.ResumeEvents();
}