diff --git a/MatterControlLib/ApplicationView/ApplicationController.cs b/MatterControlLib/ApplicationView/ApplicationController.cs index ada73712f..b6334ba23 100644 --- a/MatterControlLib/ApplicationView/ApplicationController.cs +++ b/MatterControlLib/ApplicationView/ApplicationController.cs @@ -998,7 +998,24 @@ namespace MatterHackers.MatterControl this.InitializeLibrary(); } - public void Connection_ErrorReported(object sender, string line) + /// + /// Show a notification on screen. This is usually due to a system error of some kind + /// like a bad save or load. + /// + /// The message to show + public void ShowNotification(string message) + { + foreach(var printer in ActivePrinters) + { + var terminal = printer?.Connection?.TerminalLog; + if (terminal != null) + { + terminal.WriteLine(message); + } + } + } + + public void Connection_ErrorReported(object sender, string line) { if (line != null) { diff --git a/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs b/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs index f01f30492..db186d164 100644 --- a/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/MeasureToolObject3D.cs @@ -186,18 +186,22 @@ namespace MatterHackers.MatterControl.DesignTools var doStartPosition = worldStartPosition; var doEndPosition = worldEndPosition; - controlLayer.Scene.UndoBuffer.Add(new UndoRedoActions(() => + var undoBuffer = controlLayer?.Scene?.UndoBuffer; + if (undoBuffer != null) { - worldStartPosition = undoStartPosition; - worldEndPosition = undoEndPosition; - this.Invalidate(InvalidateType.Matrix); - }, - () => - { - worldStartPosition = doStartPosition; - worldEndPosition = doEndPosition; - this.Invalidate(InvalidateType.Matrix); - })); + undoBuffer.Add(new UndoRedoActions(() => + { + worldStartPosition = undoStartPosition; + worldEndPosition = undoEndPosition; + this.Invalidate(InvalidateType.Matrix); + }, + () => + { + worldStartPosition = doStartPosition; + worldEndPosition = doEndPosition; + this.Invalidate(InvalidateType.Matrix); + })); + } } public override async void OnInvalidate(InvalidateArgs invalidateType) diff --git a/MatterControlLib/Library/Widgets/StorePage/ArticleItem.cs b/MatterControlLib/Library/Widgets/StorePage/ArticleItem.cs index 1ee56b0b4..de01c6cb5 100644 --- a/MatterControlLib/Library/Widgets/StorePage/ArticleItem.cs +++ b/MatterControlLib/Library/Widgets/StorePage/ArticleItem.cs @@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab Margin = new BorderDouble(right: ItemSpacing) }; - Load += (s, e) => WebCache.RetrieveImageAsync(image, item.icon, true, new BlenderPreMultBGRA()); + Load += (s, e) => WebCache.RetrieveImageAsync(image, item.icon, true); this.AddChild(imageWidget); } else if (item.widget_url != null) @@ -80,7 +80,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab VAnchor = VAnchor.Center, }; - Load += (s, e) => WebCache.RetrieveImageAsync(image, item.widget_url, true, new BlenderPreMultBGRA()); + Load += (s, e) => WebCache.RetrieveImageAsync(image, item.widget_url, true); whiteBackground.AddChild(imageWidget); } diff --git a/MatterControlLib/Library/Widgets/StorePage/ArticleSection.cs b/MatterControlLib/Library/Widgets/StorePage/ArticleSection.cs index bdf246547..83fdfa133 100644 --- a/MatterControlLib/Library/Widgets/StorePage/ArticleSection.cs +++ b/MatterControlLib/Library/Widgets/StorePage/ArticleSection.cs @@ -27,7 +27,9 @@ of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ +using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using MatterHackers.Agg; using MatterHackers.Agg.UI; @@ -50,7 +52,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab this.content = content; this.theme = theme; - foreach (var item in content.group_items) + var cultureInfo = new CultureInfo("en-US"); + + foreach (var item in content.group_items.OrderByDescending(i => DateTime.Parse(i.date_published, cultureInfo))) { allIconViews.Add(new ArticleItem(item, theme) { @@ -67,7 +71,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab int leftRightMargin = 5; int topBottomMargin = 5; - // Reflow Children + // Remove items and Children (this happens if the feed is different than the inital cach after being retrieved) foreach (var iconView in allIconViews) { if (this.Children.Contains(iconView)) diff --git a/MatterControlLib/Library/Widgets/StorePage/ExplorePanel.cs b/MatterControlLib/Library/Widgets/StorePage/ExplorePanel.cs index 020473495..2a79ddc89 100644 --- a/MatterControlLib/Library/Widgets/StorePage/ExplorePanel.cs +++ b/MatterControlLib/Library/Widgets/StorePage/ExplorePanel.cs @@ -210,7 +210,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab if (!loaded) { loaded = true; - WebCache.RetrieveImageAsync(image, content.image_url, false, new BlenderPreMultBGRA()); + WebCache.RetrieveImageAsync(image, content.image_url, false); } }; topBanner.AddChild(imageWidget); @@ -224,17 +224,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab // add a content section connected to the button var sectionButton = new TextButton(content.group_title, theme); sectionSelectButtons.AddChild(sectionButton); - var exploreSection = new ArticleSection(content, theme) + var articleSection = new ArticleSection(content, theme) { Visible = false, Name = content.group_title }; - contentSection.AddChild(exploreSection); + contentSection.AddChild(articleSection); sectionButton.Click += (s, e) => { foreach (var contentWidget in contentSection.Children) { - contentWidget.Visible = contentWidget == exploreSection; + contentWidget.Visible = contentWidget == articleSection; } }; } diff --git a/MatterControlLib/Library/Widgets/StorePage/ProductItem.cs b/MatterControlLib/Library/Widgets/StorePage/ProductItem.cs index 83f198162..0a4536ef1 100644 --- a/MatterControlLib/Library/Widgets/StorePage/ProductItem.cs +++ b/MatterControlLib/Library/Widgets/StorePage/ProductItem.cs @@ -49,6 +49,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab this.theme = theme; var image = new ImageBuffer(IconSize, IconSize); + image.SetRecieveBlender(new BlenderPreMultBGRA()); BackgroundRadius = 5 * GuiWidget.DeviceScale; if (item.widget_url != null) @@ -69,7 +70,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow.PlusTab VAnchor = VAnchor.Center, }; - Load += (s, e) => WebCache.RetrieveImageAsync(image, item.widget_url, true, new BlenderPreMultBGRA()); + Load += (s, e) => WebCache.RetrieveImageAsync(image, item.widget_url, true); whiteBackground.AddChild(imageWidget); } diff --git a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs index 680d3cebf..568659aed 100644 --- a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs +++ b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs @@ -293,7 +293,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow // Store tab tabControl.AddTab( - tab = new ChromeTab("Store", "Store".Localize(), tabControl, new StoreTabPage(theme), theme, hasClose: false) + tab = new ChromeTab("Store", "Resources".Localize(), tabControl, new StoreTabPage(theme), theme, hasClose: false) { MinimumSize = new Vector2(0, theme.TabButtonHeight), Name = "Store Tab", diff --git a/MatterControlLib/SlicerConfiguration/Settings/ProfileManager.cs b/MatterControlLib/SlicerConfiguration/Settings/ProfileManager.cs index fcdb4278f..a20887d75 100644 --- a/MatterControlLib/SlicerConfiguration/Settings/ProfileManager.cs +++ b/MatterControlLib/SlicerConfiguration/Settings/ProfileManager.cs @@ -948,7 +948,14 @@ namespace MatterHackers.MatterControl.SlicerConfiguration { lock (writeLock) { - File.WriteAllText(ProfilesDocPath, JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented)); + try + { + File.WriteAllText(ProfilesDocPath, JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented)); + } + catch (Exception ex) + { + ApplicationController.Instance.ShowNotification($"Profile Save Error: {ex.Message}"); + } } } diff --git a/MatterControlLib/Utilities/WebUtilities/WebCache.cs b/MatterControlLib/Utilities/WebUtilities/WebCache.cs index 6a2837259..c6ce03d8d 100644 --- a/MatterControlLib/Utilities/WebUtilities/WebCache.cs +++ b/MatterControlLib/Utilities/WebUtilities/WebCache.cs @@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl private static object locker = new object(); // Download an image from the web into the specified ImageBuffer - public static void RetrieveImageAsync(ImageBuffer imageToLoadInto, string uriToLoad, bool scaleToImageX, IRecieveBlenderByte scalingBlender = null) + public static void RetrieveImageAsync(ImageBuffer imageToLoadInto, string uriToLoad, bool scaleToImageX) { var longHash = uriToLoad.GetLongHashCode(); if (scaleToImageX) @@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl { try { - LoadImageInto(imageToLoadInto, scaleToImageX, scalingBlender, new StreamReader(imageFileName).BaseStream); + LoadImageInto(imageToLoadInto, scaleToImageX, null, new StreamReader(imageFileName).BaseStream); return; } catch @@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl { Stream stream = new MemoryStream(e.Result); - LoadImageInto(imageToLoadInto, scaleToImageX, scalingBlender, stream); + LoadImageInto(imageToLoadInto, scaleToImageX, new BlenderPreMultBGRA(), stream); if (imageToLoadInto.Width > 0 && imageToLoadInto.Height > 0 diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index 18bb089df..124112de4 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit 18bb089dfbd5474e518ce578826001f8b9e7f911 +Subproject commit 124112de436431fcbe701a13919b207eab0eb1ad diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 4142bb3dc..f98d2331a 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 4142bb3dcb97fb921fb5afb922aba575bf231515 +Subproject commit f98d2331a1f7e2443bb8423c666229544e75b32b