From 1e08d94eb10420835facfe8773b6a9f464aa3db3 Mon Sep 17 00:00:00 2001 From: larsbrubaker Date: Thu, 3 Apr 2014 15:59:36 -0700 Subject: [PATCH] Fixed some problems with part sheet names and copies. Made a warning if print leveling tries to go too low. --- ActionBar/PrinterActionRow.cs | 4 +-- ConfigurationPage/PrintLevelWizard.cs | 8 +++--- PrintQueue/PartsSheet.cs | 28 +++++++++++++------ PrinterControls/EditLevelingSettingsWindow.cs | 3 +- StaticData/Translations/Master.txt | 9 ++++++ 5 files changed, 35 insertions(+), 17 deletions(-) diff --git a/ActionBar/PrinterActionRow.cs b/ActionBar/PrinterActionRow.cs index 107a49aa3..9db3f9b28 100644 --- a/ActionBar/PrinterActionRow.cs +++ b/ActionBar/PrinterActionRow.cs @@ -46,13 +46,13 @@ namespace MatterHackers.MatterControl.ActionBar protected override void AddChildElements() { actionBarButtonFactory.invertImageLocation = false; - string connectString = LocalizedString.Get("CONNECT"); + string connectString = "CONNECT".Localize(); connectPrinterButton = actionBarButtonFactory.Generate(connectString, "icon_power_32x32.png"); connectPrinterButton.Margin = new BorderDouble(0, 0, 3); connectPrinterButton.VAnchor = VAnchor.ParentCenter; connectPrinterButton.Cursor = Cursors.Hand; - string disconnectString = LocalizedString.Get("DISCONNECT"); + string disconnectString = "DISCONNECT".Localize(); disconnectPrinterButton = actionBarButtonFactory.Generate(disconnectString, "icon_power_32x32.png"); disconnectPrinterButton.Margin = new BorderDouble(0, 0, 3); disconnectPrinterButton.VAnchor = VAnchor.ParentCenter; diff --git a/ConfigurationPage/PrintLevelWizard.cs b/ConfigurationPage/PrintLevelWizard.cs index 0fc0196c9..7474b8e2f 100644 --- a/ConfigurationPage/PrintLevelWizard.cs +++ b/ConfigurationPage/PrintLevelWizard.cs @@ -192,8 +192,8 @@ namespace MatterHackers.MatterControl return zButtons; } - string zIsTooLowMessage = "You cannot move any lower. This position on your bed is too low for the extruder to reach. You need to raise your bed, or adjust your limits to allow the extruder to go lower.".Localize(); - string zTooLowTitle = "Waring Moving Too Low".Localize(); + static string zIsTooLowMessage = "You cannot move any lower. This position on your bed is too low for the extruder to reach. You need to raise your bed, or adjust your limits to allow the extruder to go lower.".Localize(); + static string zTooLowTitle = "Waring Moving Too Low".Localize(); void zMinusControl_Click(object sender, MouseEventArgs mouseEvent) { if (PrinterCommunication.Instance.LastReportedPosition.z - moveAmount < 0) @@ -219,8 +219,8 @@ namespace MatterHackers.MatterControl { static string setZHeightCoarseInstruction1 = LocalizedString.Get("Using the [Z] controls on this screen, we will now take a coarse measurement of the extruder height at this position."); - static string setZHeightCourseInstructTxtOne = LocalizedString.Get("Place the paper under the extruder"); - static string setZHeightCourseInstructTxtTwo = LocalizedString.Get("Using the above contols"); + static string setZHeightCourseInstructTxtOne = "Place the paper under the extruder".Localize(); + static string setZHeightCourseInstructTxtTwo = "Using the above contols".Localize(); static string setZHeightCourseInstructTxtThree = LocalizedString.Get("Press [Z-] until there is resistance to moving the paper"); static string setZHeightCourseInstructTxtFour = LocalizedString.Get("Press [Z+] once to release the paper"); static string setZHeightCourseInstructTxtFive = LocalizedString.Get("Finally click 'Next' to continue."); diff --git a/PrintQueue/PartsSheet.cs b/PrintQueue/PartsSheet.cs index 1d1050588..aa4f05e41 100644 --- a/PrintQueue/PartsSheet.cs +++ b/PrintQueue/PartsSheet.cs @@ -72,7 +72,19 @@ namespace MatterHackers.MatterControl public event EventHandler DoneSaving; public event EventHandler UpdateRemainingItems; - List stlFilesToPrint; + public class FileNameAndPresentationName + { + public string fileName; + public string presentationName; + + public FileNameAndPresentationName(string fileName, string presentationName) + { + this.fileName = fileName; + this.presentationName = presentationName; + } + } + + List stlFilesToPrint; List partImagesToPrint = new List(); const double inchesPerMm = 0.0393701; @@ -149,10 +161,10 @@ namespace MatterHackers.MatterControl SheetDpi = 300; SheetSizeInches = new Vector2(8.5, 11); // make sure we have our own list so it can't get stepped on while we output it. - stlFilesToPrint = new List(); + stlFilesToPrint = new List(); foreach(PrintItem stlToCopy in dataSource) { - stlFilesToPrint.Add(stlToCopy.FileLocation); + stlFilesToPrint.Add(new FileNameAndPresentationName(stlToCopy.FileLocation, stlToCopy.Name)); } } @@ -182,9 +194,9 @@ namespace MatterHackers.MatterControl currentlySaving = true; countThatHaveBeenSaved = 0; // first create images for all the parts - foreach (string stlFileName in stlFilesToPrint) + foreach (FileNameAndPresentationName stlFileNames in stlFilesToPrint) { - Mesh loadedMesh = StlProcessing.Load(stlFileName); + Mesh loadedMesh = StlProcessing.Load(stlFileNames.fileName); if (loadedMesh != null) { AxisAlignedBoundingBox aabb = loadedMesh.GetAxisAlignedBoundingBox(); @@ -193,8 +205,7 @@ namespace MatterHackers.MatterControl double textSpaceMM = 5; double heightMM = textSpaceMM + bounds2D.Height + PartMarginMM * 2; - string partName = System.IO.Path.GetFileName(System.IO.Path.GetFileName(stlFileName)); - TypeFacePrinter typeFacePrinter = new TypeFacePrinter(partName, 28, Vector2.Zero, Justification.Center, Baseline.BoundsCenter); + TypeFacePrinter typeFacePrinter = new TypeFacePrinter(stlFileNames.presentationName, 28, Vector2.Zero, Justification.Center, Baseline.BoundsCenter); double sizeOfNameX = typeFacePrinter.GetSize().x + PartMarginPixels * 2; Vector2 sizeOfRender = new Vector2(widthInMM * PixelPerMM, heightMM * PixelPerMM); @@ -219,7 +230,7 @@ namespace MatterHackers.MatterControl countThatHaveBeenSaved++; if (UpdateRemainingItems != null) { - UpdateRemainingItems(this, new StringEventArgs(Path.GetFileName(stlFileName))); + UpdateRemainingItems(this, new StringEventArgs(Path.GetFileName(stlFileNames.presentationName))); } } @@ -231,7 +242,6 @@ namespace MatterHackers.MatterControl document.Info.Subject = "This is a list of the parts that are in a queue from MatterControl."; document.Info.Keywords = "MatterControl, STL, 3D Printing"; - int nextPartToPrintIndex = 0; int plateNumber = 1; bool done = false; diff --git a/PrinterControls/EditLevelingSettingsWindow.cs b/PrinterControls/EditLevelingSettingsWindow.cs index 94ce8f74a..cf0ba8cf9 100644 --- a/PrinterControls/EditLevelingSettingsWindow.cs +++ b/PrinterControls/EditLevelingSettingsWindow.cs @@ -135,7 +135,7 @@ namespace MatterHackers.MatterControl TextWidget positionLabel; string whichPositionText = LocalizedString.Get("Position"); - positionLabel = new TextWidget(string.Format("{0} {1,-14} x: {2,-10:0.00} y:{3,-10:0.00}", whichPositionText, preset_count, settingsArray[i], settingsArray[i + 1]), textColor: ActiveTheme.Instance.PrimaryTextColor); + positionLabel = new TextWidget(string.Format("{0} {1,-14} x: {2,-10:0.00} y:{3,-10:0.00} z:", whichPositionText, preset_count, settingsArray[i], settingsArray[i + 1]), textColor: ActiveTheme.Instance.PrimaryTextColor); positionLabel.VAnchor = VAnchor.ParentCenter; leftRightEdit.AddChild(positionLabel); @@ -156,7 +156,6 @@ namespace MatterHackers.MatterControl leftRightEdit.AddChild(valueEdit); listWithValues.Add(valueEdit); - //leftRightEdit.AddChild(textImageButtonFactory.Generate("Delete")); presetsFormContainer.AddChild(leftRightEdit); preset_count += 1; } diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 13cb813d4..f60f6ae72 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -1794,3 +1794,12 @@ Translated:We will now finalize our measurement of the extruder height at this p English:Press [Z-] one click PAST the first hint of resistance Translated:Press [Z-] one click PAST the first hint of resistance +English:Save Parts Sheet +Translated:Save Parts Sheet + +English:MatterContol +Translated:MatterContol + +English:Saving to Parts Sheet +Translated:Saving to Parts Sheet +