From 2173b43e4643d2a8a472fb50e65bca4ccecedf6c Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Mon, 13 Jun 2016 15:28:56 -0700 Subject: [PATCH] Working on settings import and export wizards --- SetupWizard/ExportSettingsPage.cs | 38 ++++++++++++++++- SetupWizard/ImportSettingsPage.cs | 53 +++++++++++++++++++++++- StaticData/SliceSettings/Properties.json | 4 +- StaticData/Translations/Master.txt | 9 ++++ 4 files changed, 99 insertions(+), 5 deletions(-) diff --git a/SetupWizard/ExportSettingsPage.cs b/SetupWizard/ExportSettingsPage.cs index 00c8ac52c..f291fda31 100644 --- a/SetupWizard/ExportSettingsPage.cs +++ b/SetupWizard/ExportSettingsPage.cs @@ -34,6 +34,7 @@ using MatterHackers.MatterControl; using MatterHackers.MatterControl.CustomWidgets; using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.Localizations; +using MatterHackers.Agg; namespace MatterHackers.MatterControl { @@ -44,22 +45,40 @@ namespace MatterHackers.MatterControl public ExportSettingsPage() : base("Cancel") { - var container = new FlowLayoutWidget(FlowDirection.TopToBottom); + var container = new FlowLayoutWidget(FlowDirection.TopToBottom) + { + HAnchor = HAnchor.ParentLeftRight, + }; contentRow.AddChild(container); + // export as matter control var matterControlButton = new RadioButton("Export MatterControl settings (*.printer)".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor); matterControlButton.CheckedStateChanged += (s, e) => exportMode = "mattercontrol"; matterControlButton.Checked = true; container.AddChild(matterControlButton); + container.AddChild( + CreateDetailInfo("Export the complete set of features for this profile. All settings, quality and material presets, and editing states.") + ); + + // export as slic3r var slic3rButton = new RadioButton("Export Slic3r settings (*.ini)".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor); slic3rButton.CheckedStateChanged += (s, e) => exportMode = "slic3r"; container.AddChild(slic3rButton); + container.AddChild( + CreateDetailInfo("Export as a config.ini file that can be read by older versions of Matter Control and Slic3r.") + ); + + // export as cura #if DEBUG var curaButton = new RadioButton("Export Cura settings (*.ini)".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor); curaButton.CheckedStateChanged += (s, e) => exportMode = "cura"; container.AddChild(curaButton); + + container.AddChild( + CreateDetailInfo("Export as a file that can be read by Cura.\nNote: Not all settings are exportable in this format.") + ); #endif var exportButton = textImageButtonFactory.Generate("Export Settings".Localize()); @@ -74,6 +93,23 @@ namespace MatterHackers.MatterControl footerRow.AddChild(cancelButton); } + private GuiWidget CreateDetailInfo(string detailText) + { + var wrappedText = new WrappedTextWidget(detailText, 5) + { + TextColor = ActiveTheme.Instance.PrimaryTextColor, + }; + + var container = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.FitToChildren) + { + Margin = new BorderDouble(25, 15, 5, 5), + }; + + container.AddChild(wrappedText); + + return container; + } + private void exportButton_Click() { WizardWindow.Close(); diff --git a/SetupWizard/ImportSettingsPage.cs b/SetupWizard/ImportSettingsPage.cs index 4f0e61961..bf97a3202 100644 --- a/SetupWizard/ImportSettingsPage.cs +++ b/SetupWizard/ImportSettingsPage.cs @@ -46,28 +46,56 @@ namespace MatterHackers.MatterControl public ImportSettingsPage() : base("Cancel") { - var container = new FlowLayoutWidget(FlowDirection.TopToBottom); + var container = new FlowLayoutWidget(FlowDirection.TopToBottom) + { + HAnchor = HAnchor.ParentLeftRight, + }; contentRow.AddChild(container); + // add new profile var newPrinterButton = new RadioButton("Import as new printer profile".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor); newPrinterButton.CheckedStateChanged += (s, e) => importMode = "new"; newPrinterButton.Checked = true; container.AddChild(newPrinterButton); this.importMode = "new"; + container.AddChild( + CreateDetailInfo("Add a new printer profile, base on the imported settings, to your list of available printers.\nThis will not change your current settings.") + ); + + // merge into current settings var mergeButton = new RadioButton("Merge into current printer profile".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor); mergeButton.CheckedStateChanged += (s, e) => importMode = "merge"; container.AddChild(mergeButton); + container.AddChild( + CreateDetailInfo("Merge imported settings and presets into your current profile. \nNote: You will still be able to revert to the factory settings at any time.") + ); + + // replace current settings var replaceButton = new RadioButton("Replace current printer profile".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor); replaceButton.CheckedStateChanged += (s, e) => importMode = "replace"; container.AddChild(replaceButton); + container.AddChild( + CreateDetailInfo("Replace current settings and presets with the imported profile. \nNote: You will still be able to revert to the factory settings at any time.") + ); + + // add as preset + var newPresetButton = new RadioButton("Add as a new quality preset".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor); + newPresetButton.CheckedStateChanged += (s, e) => importMode = "qualityPreset"; + container.AddChild(newPresetButton); + + container.AddChild( + CreateDetailInfo("Add new quality preset(s) with the settings from this import.") + ); + + var importButton = textImageButtonFactory.Generate("Import Settings".Localize()); importButton.Click += (s, e) => UiThread.RunOnIdle(() => { FileDialog.OpenFileDialog( - new OpenFileDialogParams("settings files|*.ini;*.printer,"), + new OpenFileDialogParams("settings files|*.ini;*.printer;*.slice"), (dialogParams) => ImportSettingsFile(dialogParams.FileName)); }); @@ -80,6 +108,23 @@ namespace MatterHackers.MatterControl footerRow.AddChild(cancelButton); } + private GuiWidget CreateDetailInfo(string detailText) + { + var wrappedText = new WrappedTextWidget(detailText, 5) + { + TextColor = ActiveTheme.Instance.PrimaryTextColor, + }; + + var container = new GuiWidget(HAnchor.ParentLeftRight, VAnchor.FitToChildren) + { + Margin = new BorderDouble(25, 15, 5, 5), + }; + + container.AddChild(wrappedText); + + return container; + } + private void ImportSettingsFile(string settingsFilePath) { WizardWindow.Close(); @@ -94,6 +139,10 @@ namespace MatterHackers.MatterControl case "replace": ReplaceOrMergeSettings(settingsFilePath); break; + + case "qualityPreset": + throw new NotImplementedException("import to preset"); + break; } } diff --git a/StaticData/SliceSettings/Properties.json b/StaticData/SliceSettings/Properties.json index 2e4a81ac7..5c1cab772 100644 --- a/StaticData/SliceSettings/Properties.json +++ b/StaticData/SliceSettings/Properties.json @@ -81,8 +81,8 @@ "QuickMenuSettings": [], "SetSettingsOnChange": [], "SlicerConfigName": "layer_to_pause", - "PresentationName": "Select Layer To Pause:", - "HelpText": "If you want to select a layer to pause your print on do so here (for changing filament)", + "PresentationName": "Layers To Pause:", + "HelpText": "The layers at which the print will pause, allowing for a change in filament. Leave blank to disable. To pause on multiple layers, separate the layer numbers with semicolons. For example: \"16; 37\".", "DataEditType": "STRING", "ExtraSettings": "", "ShowAsOverride": true, diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 28495bd12..88f82ccf4 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -4996,3 +4996,12 @@ Translated:Replace current printer profile English:Import Settings Translated:Import Settings +English:The layers at which the print will pause, allowing for a change in filament. Leave blank to disable. To pause on multiple layers, separate the layer numbers with semicolons. For example: "16; 37". +Translated:The layers at which the print will pause, allowing for a change in filament. Leave blank to disable. To pause on multiple layers, separate the layer numbers with semicolons. For example: "16; 37". + +English:Layers To Pause: +Translated:Layers To Pause: + +English:Add as a new quality preset +Translated:Add as a new quality preset +