Merge pull request #770 from larsbrubaker/master
Edit button for printer
This commit is contained in:
commit
9102a03dc6
11 changed files with 117 additions and 17 deletions
|
|
@ -29,11 +29,13 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.GuiAutomation;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.PrinterCommunication;
|
||||
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MatterHackers.MatterControl.ActionBar
|
||||
{
|
||||
|
|
@ -152,11 +154,58 @@ 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());
|
||||
}
|
||||
|
||||
private void EditButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Button editButton = sender as Button;
|
||||
editButton.ToolTipText = "Edit Current Printer Settings".Localize();
|
||||
if (editButton != null)
|
||||
{
|
||||
editButton.Closed += (s, e2) =>
|
||||
{
|
||||
editButton.Click -= EditButton_Click;
|
||||
};
|
||||
|
||||
Task.Run((Action)AutomationTest);
|
||||
}
|
||||
}
|
||||
|
||||
private void AutomationTest()
|
||||
{
|
||||
AutomationRunner testRunner = new AutomationRunner(inputType: AutomationRunner.InputType.Simulated);
|
||||
if (testRunner.NameExists("SettingsAndControls"))
|
||||
{
|
||||
testRunner.ClickByName("SettingsAndControls", 5);
|
||||
testRunner.Wait(.5);
|
||||
}
|
||||
testRunner.ClickByName("Slice Settings Tab", .1);
|
||||
testRunner.ClickByName("Slice Settings Tab", .1);
|
||||
testRunner.ClickByName("Slice Settings Tab", .1);
|
||||
testRunner.ClickByName("Printer Tab", .2);
|
||||
testRunner.ClickByName("Connection Tab", .1);
|
||||
testRunner.MoveToByName("Printer Name Edit", .1);
|
||||
testRunner.MoveToByName("Auto Connect Checkbox", .1);
|
||||
testRunner.MoveToByName("Baud Rate Edit", .1);
|
||||
testRunner.MoveToByName("Printer Name Edit", .1);
|
||||
testRunner.Dispose();
|
||||
}
|
||||
|
||||
|
||||
protected override void AddHandlers()
|
||||
{
|
||||
ActiveSliceSettings.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
|
||||
|
|
|
|||
|
|
@ -228,20 +228,22 @@ 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)
|
||||
{
|
||||
editButton = new Button(0, 0, new ButtonViewThreeImage(SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.White),
|
||||
SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.Gray),
|
||||
normalImage));
|
||||
editButton = new Button(0, 0, new ButtonViewThreeImage(
|
||||
SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.White.AdjustLightness(.8).GetAsRGBA_Bytes()),
|
||||
SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.White.AdjustLightness(.9).GetAsRGBA_Bytes()),
|
||||
SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.White.AdjustLightness(1).GetAsRGBA_Bytes())));
|
||||
}
|
||||
else
|
||||
{
|
||||
editButton = new Button(0, 0, new ButtonViewThreeImage(normalImage,
|
||||
SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.Gray),
|
||||
SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.White)));
|
||||
editButton = new Button(0, 0, new ButtonViewThreeImage(
|
||||
SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.White.AdjustLightness(.4).GetAsRGBA_Bytes()),
|
||||
SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.White.AdjustLightness(.2).GetAsRGBA_Bytes()),
|
||||
SetToColor.CreateSetToColor(normalImage, RGBA_Bytes.White.AdjustLightness(0).GetAsRGBA_Bytes())));
|
||||
}
|
||||
|
||||
return editButton;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.Agg.ImageProcessing;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -115,7 +116,9 @@ namespace MatterHackers.MatterControl
|
|||
if (noThumbnailImage.Width == 0)
|
||||
{
|
||||
StaticData.Instance.LoadIcon(noThumbnailFileName, noThumbnailImage);
|
||||
noThumbnailImage.InvertLightness();
|
||||
StaticData.Instance.LoadIcon(buildingThumbnailFileName, buildingThumbnailImage);
|
||||
buildingThumbnailImage.InvertLightness();
|
||||
}
|
||||
this.thumbnailImage = new ImageBuffer(buildingThumbnailImage);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using MatterHackers.GCodeVisualizer;
|
||||
using Gaming.Game;
|
||||
using MatterHackers.GuiAutomation;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -92,8 +92,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
editButton = TextImageButtonFactory.GetThemedEditButton();
|
||||
|
||||
editButton.ToolTipText = "Edit Selected Setting".Localize();
|
||||
|
||||
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 +147,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
};
|
||||
|
||||
container.AddChild(editButton);
|
||||
container.AddChild(dropDownList);
|
||||
container.AddChild(editButton);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -687,7 +687,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
var intEditWidget = new MHNumberEdit(currentValue, pixelWidth: intEditWidth, tabIndex: tabIndexForItem++)
|
||||
{
|
||||
ToolTipText = settingData.HelpText,
|
||||
SelectAllOnFocus = true
|
||||
SelectAllOnFocus = true,
|
||||
Name = settingData.PresentationName + " Edit",
|
||||
};
|
||||
intEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
|
||||
{
|
||||
|
|
@ -1045,8 +1046,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
case OrganizerSettingsData.DataEditTypes.STRING:
|
||||
{
|
||||
var stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++);
|
||||
var stringEdit = new MHTextEditWidget(sliceSettingValue, pixelWidth: 120, tabIndex: tabIndexForItem++)
|
||||
{
|
||||
Name = settingData.PresentationName + " Edit",
|
||||
};
|
||||
stringEdit.ToolTipText = settingData.HelpText;
|
||||
|
||||
stringEdit.ActualTextEditWidget.EditComplete += (sender, e) =>
|
||||
{
|
||||
SaveSetting(settingData.SlicerConfigName, ((TextEditWidget)sender).Text);
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 1,013 B After Width: | Height: | Size: 1,013 B |
|
|
@ -11,7 +11,7 @@ Simple
|
|||
Connection
|
||||
Description
|
||||
MatterControl.PrinterName
|
||||
Connection
|
||||
Details
|
||||
MatterControl.AutoConnect
|
||||
MatterControl.BaudRate
|
||||
MatterControl.ComPort
|
||||
|
|
@ -72,7 +72,7 @@ Intermediate
|
|||
Connection
|
||||
Description
|
||||
MatterControl.PrinterName
|
||||
Connection
|
||||
Details
|
||||
MatterControl.AutoConnect
|
||||
MatterControl.BaudRate
|
||||
MatterControl.ComPort
|
||||
|
|
@ -272,7 +272,7 @@ Advanced
|
|||
Connection
|
||||
Description
|
||||
MatterControl.PrinterName
|
||||
Connection
|
||||
Details
|
||||
MatterControl.AutoConnect
|
||||
MatterControl.BaudRate
|
||||
MatterControl.ComPort
|
||||
|
|
|
|||
|
|
@ -4849,3 +4849,15 @@ Translated:Connection Info
|
|||
English:Camera Monitoring
|
||||
Translated:Camera Monitoring
|
||||
|
||||
English:Details
|
||||
Translated:Details
|
||||
|
||||
English:Edit Printer Settings
|
||||
Translated:Edit Printer Settings
|
||||
|
||||
English:Edit Selected Setting
|
||||
Translated:Edit Selected Setting
|
||||
|
||||
English:Edit Current Printer Settings
|
||||
Translated:Edit Current Printer Settings
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 8ef10cd1bc7fd51122ee3c518f0a20a375ab82a9
|
||||
Subproject commit fe51518649cfd8207cccab18ee9f1dc262eb71b5
|
||||
Loading…
Add table
Add a link
Reference in a new issue