From 47062356db05f998fe132d36b3ab54eae58530a8 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Mon, 21 Sep 2015 15:27:32 -0700 Subject: [PATCH] Prevent interaction with library placeholder collections - Remove hard-coded place holder tokens - Fix extruder number comments in exported gcode --- Library/LibraryRowItem.cs | 2 ++ Library/LibraryRowItemCollection.cs | 8 +++++++- Library/LibraryRowItemPart.cs | 2 +- SlicerConfiguration/SlicerMapping/MappingClasses.cs | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Library/LibraryRowItem.cs b/Library/LibraryRowItem.cs index 37fd9f336..b334fb9cc 100644 --- a/Library/LibraryRowItem.cs +++ b/Library/LibraryRowItem.cs @@ -39,6 +39,8 @@ namespace MatterHackers.MatterControl.PrintLibrary { public abstract class LibraryRowItem : GuiWidget { + public static readonly string LoadingPlaceholderToken = "!Placeholder_ItemToken!"; + public bool IsSelectedItem { get diff --git a/Library/LibraryRowItemCollection.cs b/Library/LibraryRowItemCollection.cs index e19336d2a..92f6dfdd9 100644 --- a/Library/LibraryRowItemCollection.cs +++ b/Library/LibraryRowItemCollection.cs @@ -64,6 +64,12 @@ namespace MatterHackers.MatterControl.PrintLibrary this.Name = this.ItemName + " Row Item Collection"; + if (collection.Key == LibraryRowItem.LoadingPlaceholderToken) + { + this.EnableSlideInActions = false; + this.IsViewHelperItem = true; + } + CreateGuiElements(); } @@ -170,7 +176,7 @@ namespace MatterHackers.MatterControl.PrintLibrary public override void OnMouseDown(MouseEventArgs mouseEvent) { - if (mouseEvent.Clicks == 2) + if (mouseEvent.Clicks == 2 && this.EnableSlideInActions) { UiThread.RunOnIdle(ChangeCollection); } diff --git a/Library/LibraryRowItemPart.cs b/Library/LibraryRowItemPart.cs index 794b32e35..acaec48bf 100644 --- a/Library/LibraryRowItemPart.cs +++ b/Library/LibraryRowItemPart.cs @@ -71,7 +71,7 @@ namespace MatterHackers.MatterControl.PrintLibrary } this.ItemName = libraryProvider.GetPrintItemName(itemIndex); - if(this.ItemName.IndexOf("!ProviderIsLoading!") != -1) + if(this.ItemName == LibraryRowItem.LoadingPlaceholderToken) { this.ItemName = "Retrieving Contents...".Localize(); this.IsViewHelperItem = true; diff --git a/SlicerConfiguration/SlicerMapping/MappingClasses.cs b/SlicerConfiguration/SlicerMapping/MappingClasses.cs index e05a77926..c1bd38101 100644 --- a/SlicerConfiguration/SlicerMapping/MappingClasses.cs +++ b/SlicerConfiguration/SlicerMapping/MappingClasses.cs @@ -218,7 +218,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration if (materialTemperature != "0") { string setTempString = "M109 T{0} S{1}".FormatWith(extruderIndex0Based, materialTemperature); - AddDefaultIfNotPresent(preStartGCode, setTempString, preStartGCodeLines, string.Format("wait for extruder {0}", extruderIndex0Based)); + AddDefaultIfNotPresent(preStartGCode, setTempString, preStartGCodeLines, string.Format("wait for extruder {0}", extruderIndex0Based + 1)); } } } @@ -270,7 +270,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration if (materialTemperature != "0") { string setTempString = "M109 T{0} S{1}".FormatWith(extruderIndex0Based, materialTemperature); - AddDefaultIfNotPresent(postStartGCode, setTempString, postStartGCodeLines, string.Format("wait for extruder {0} to reach temperature", extruderIndex0Based)); + AddDefaultIfNotPresent(postStartGCode, setTempString, postStartGCodeLines, string.Format("wait for extruder {0} to reach temperature", extruderIndex0Based + 1)); } } }