Improving printers screen

This commit is contained in:
Lars Brubaker 2022-03-11 18:04:32 -08:00
parent a807567a92
commit 91797abcd3
22 changed files with 146 additions and 1452 deletions

View file

@ -86,7 +86,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
rootNode.TreeView = treeView;
rootNode.Load += (s, e) =>
{
var image = OemSettings.Instance.GetIcon(oem.Key);
var image = OemSettings.Instance.GetIcon(oem.Key, theme);
SetImage(rootNode, image);
};

View file

@ -40,6 +40,7 @@ using MatterHackers.MatterControl.ConfigurationPage;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.SettingsManagement;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
using Newtonsoft.Json;
namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
@ -49,7 +50,7 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
private ThemeConfig theme;
private GuiWidget headingRow;
private PrinterInfo printerInfo;
private FlowLayoutWidget productDataContainer;
private GuiWidget productDataContainer;
public PrinterDetails(PrinterInfo printerInfo, ThemeConfig theme, bool showOpenButton)
: base(FlowDirection.TopToBottom)
@ -58,7 +59,7 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
this.theme = theme;
headingRow = this.AddHeading(
OemSettings.Instance.GetIcon(printerInfo.Make),
OemSettings.Instance.GetIcon(printerInfo.Make, theme),
printerInfo.Name);
headingRow.AddChild(new HorizontalSpacer());
@ -103,6 +104,19 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
if (!string.IsNullOrWhiteSpace(StoreID))
{
// add a section to hold the data about the printer
var contentScroll = new ScrollableWidget(true);
contentScroll.ScrollArea.HAnchor |= HAnchor.Stretch;
contentScroll.ScrollArea.VAnchor = VAnchor.Fit;
contentScroll.AnchorAll();
contentScroll.AddChild(productDataContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
HAnchor = HAnchor.Stretch
});
this.AddChild(contentScroll);
try
{
// put in controls from the feed that show relevant printer information
@ -133,6 +147,8 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
}
CreateProductDataWidgets(result.ProductSku);
contentScroll.TopLeftOffset = new Vector2(0, 0);
});
});
}
@ -140,12 +156,6 @@ namespace MatterHackers.MatterControl.Library.Widgets.HardwarePage
{
Trace.WriteLine("Error collecting or loading printer details: " + ex.Message);
}
// add a section to hold the data about the printer
this.AddChild(productDataContainer = new FlowLayoutWidget(FlowDirection.TopToBottom)
{
HAnchor = HAnchor.Stretch
});
}
headingRow.Visible = this.ShowHeadingRow;

View file

@ -27,49 +27,24 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System.Linq;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.Library.Widgets.HardwarePage;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.PrintLibrary
{
public class HardwareTabPage : FlowLayoutWidget
public class PrintersTabPage : FlowLayoutWidget
{
private ThemeConfig theme;
public HardwareTabPage(ThemeConfig theme)
public PrintersTabPage(ThemeConfig theme)
: base (FlowDirection.TopToBottom)
{
this.theme = theme;
this.Padding = 0;
this.HAnchor = HAnchor.Stretch;
this.VAnchor = VAnchor.Stretch;
var toolbar = new Toolbar(theme.TabbarPadding, theme.CreateSmallResetButton())
{
HAnchor = HAnchor.Stretch,
VAnchor = VAnchor.Fit,
Padding = theme.ToolbarPadding
};
theme.ApplyBottomBorder(toolbar);
toolbar.AddChild(new TextButton("Inventory".Localize(), theme)
{
Padding = new BorderDouble(6, 0),
MinimumSize = new Vector2(0, theme.ButtonHeight),
Selectable = false
});
this.AddChild(toolbar);
var horizontalSplitter = new Splitter()
{
SplitterDistance = UserSettings.Instance.LibraryViewWidth,

View file

@ -127,17 +127,6 @@ namespace MatterHackers.MatterControl.PrintLibrary
HardwareTreeView.CreatePrinterProfilesTree(printersNode, theme);
this.Invalidate();
// Filament
var materialsNode = new TreeNode(theme)
{
Text = "Materials".Localize(),
AlwaysExpandable = true,
Image = StaticData.Instance.LoadIcon("filament.png", 16, 16).SetToColor(theme.TextColor)
};
materialsNode.TreeView = this;
rootColumn.AddChild(materialsNode);
// Register listeners
PrinterSettings.AnyPrinterSettingChanged += Printer_SettingChanged;
@ -170,7 +159,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
printerNode.Load += (s, e) =>
{
printerNode.Image = OemSettings.Instance.GetIcon(printer.Make);
printerNode.Image = OemSettings.Instance.GetIcon(printer.Make, theme);
};
printersNode.Nodes.Add(printerNode);
@ -202,7 +191,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
printerNode.Load += (s, e) =>
{
printerNode.Image = OemSettings.Instance.GetIcon(printer.Settings.GetValue(SettingsKey.make));
printerNode.Image = OemSettings.Instance.GetIcon(printer.Settings.GetValue(SettingsKey.make), theme);
};
printersNode.Nodes.Add(printerNode);