Working on edit button for printer

This commit is contained in:
Lars Brubaker 2016-05-13 11:37:22 -07:00
parent 4945580ae5
commit 5a908c7973
7 changed files with 71 additions and 7 deletions

View file

@ -152,12 +152,49 @@ namespace MatterHackers.MatterControl.ActionBar
this.AddChild(connectPrinterButton);
this.AddChild(disconnectPrinterButton);
this.AddChild(selectActivePrinterButton);
FlowLayoutWidget printerSelectorAndEditButton = new FlowLayoutWidget()
{
HAnchor = HAnchor.ParentLeftRight,
};
printerSelectorAndEditButton.AddChild(selectActivePrinterButton);
Button editButton = TextImageButtonFactory.GetThemedEditButton();
editButton.VAnchor = VAnchor.ParentCenter;
editButton.Click += EditButton_Click;
printerSelectorAndEditButton.AddChild(editButton);
this.AddChild(printerSelectorAndEditButton);
this.AddChild(resetConnectionButton);
//this.AddChild(CreateOptionsMenu());
}
protected override void AddHandlers()
private void EditButton_Click(object sender, EventArgs e)
{
Button editButton = sender as Button;
if (editButton != null)
{
editButton.Closed += (s, e2) =>
{
editButton.Click -= EditButton_Click;
};
Task.Run((Action)AutomationTest);
}
}
private void AutomationTest()
{
AutomationRunner test = new AutomationRunner("C:/TestImages");
test.Wait(2);
test.ClickByName("SettingsAndControls");
test.Wait(2);
test.ClickImage("BackButton.png");
//ImageIO.SaveImageData("test.png", test.GetCurrentScreen());
}
protected override void AddHandlers()
{
ActiveSliceSettings.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);

View file

@ -228,7 +228,7 @@ namespace MatterHackers.MatterControl
public static Button GetThemedEditButton()
{
ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_32x32.png", 16, 16);
ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit.png", 16, 16);
Button editButton;
if (ActiveTheme.Instance.IsDarkTheme)

View file

@ -590,6 +590,7 @@ namespace MatterHackers.MatterControl
if (firstDraw)
{
DrawAfter += ShowNamesUnderMouse;
firstDraw = false;
foreach (string arg in commandLineArgs)
{
@ -757,6 +758,32 @@ namespace MatterHackers.MatterControl
#endif
}
bool showNamesUnderMouse = false;
public override void OnKeyDown(KeyEventArgs keyEvent)
{
if (keyEvent.KeyCode == Keys.F2)
{
Task.Run((Action)AutomationTest);
}
else if (keyEvent.KeyCode == Keys.F1)
{
showNamesUnderMouse = !showNamesUnderMouse;
}
base.OnKeyDown(keyEvent);
}
private void AutomationTest()
{
AutomationRunner test = new AutomationRunner();
test.ClickByName("Library Tab", 5);
test.ClickByName("Queue Tab", 5);
test.ClickByName("Queue Item SkeletonArm_Med", 5);
test.ClickByName("3D View Edit", 5);
test.Wait(.2);
test.DragByName("SkeletonArm_Med_IObject3D", 5);
test.DropByName("SkeletonArm_Med_IObject3D", 5, offset: new Point2D(0, -40));
}
public static void CheckKnownAssemblyConditionalCompSymbols()
{
MatterControlApplication.AssertDebugNotDefined();

View file

@ -212,7 +212,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
addButton.Enabled = false;
}
ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit_32x32.png", 14, 14);
ImageBuffer normalImage = StaticData.Instance.LoadIcon("icon_edit.png", 14, 14);
if (!ActiveTheme.Instance.IsDarkTheme)
{

View file

@ -93,7 +93,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
editButton = TextImageButtonFactory.GetThemedEditButton();
editButton.VAnchor = VAnchor.ParentCenter;
editButton.Margin = new BorderDouble(right: 6);
editButton.Margin = new BorderDouble(left: 6);
editButton.Click += (sender, e) =>
{
if (layerType == NamedSettingsLayers.Material)
@ -145,8 +145,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
}
};
container.AddChild(editButton);
container.AddChild(dropDownList);
container.AddChild(editButton);
return container;
}

View file

Before

Width:  |  Height:  |  Size: 1,013 B

After

Width:  |  Height:  |  Size: 1,013 B

Before After
Before After

@ -1 +1 @@
Subproject commit 8ef10cd1bc7fd51122ee3c518f0a20a375ab82a9
Subproject commit 1cefd740213b2b8e071c579e45546d7fcbdabe8a