Working on settings import and export wizards
This commit is contained in:
parent
85caa12dfe
commit
2173b43e46
4 changed files with 99 additions and 5 deletions
|
|
@ -34,6 +34,7 @@ using MatterHackers.MatterControl;
|
||||||
using MatterHackers.MatterControl.CustomWidgets;
|
using MatterHackers.MatterControl.CustomWidgets;
|
||||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||||
using MatterHackers.Localizations;
|
using MatterHackers.Localizations;
|
||||||
|
using MatterHackers.Agg;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl
|
namespace MatterHackers.MatterControl
|
||||||
{
|
{
|
||||||
|
|
@ -44,22 +45,40 @@ namespace MatterHackers.MatterControl
|
||||||
public ExportSettingsPage() :
|
public ExportSettingsPage() :
|
||||||
base("Cancel")
|
base("Cancel")
|
||||||
{
|
{
|
||||||
var container = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
var container = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||||
|
{
|
||||||
|
HAnchor = HAnchor.ParentLeftRight,
|
||||||
|
};
|
||||||
contentRow.AddChild(container);
|
contentRow.AddChild(container);
|
||||||
|
|
||||||
|
// export as matter control
|
||||||
var matterControlButton = new RadioButton("Export MatterControl settings (*.printer)".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
var matterControlButton = new RadioButton("Export MatterControl settings (*.printer)".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||||
matterControlButton.CheckedStateChanged += (s, e) => exportMode = "mattercontrol";
|
matterControlButton.CheckedStateChanged += (s, e) => exportMode = "mattercontrol";
|
||||||
matterControlButton.Checked = true;
|
matterControlButton.Checked = true;
|
||||||
container.AddChild(matterControlButton);
|
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);
|
var slic3rButton = new RadioButton("Export Slic3r settings (*.ini)".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||||
slic3rButton.CheckedStateChanged += (s, e) => exportMode = "slic3r";
|
slic3rButton.CheckedStateChanged += (s, e) => exportMode = "slic3r";
|
||||||
container.AddChild(slic3rButton);
|
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
|
#if DEBUG
|
||||||
var curaButton = new RadioButton("Export Cura settings (*.ini)".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
var curaButton = new RadioButton("Export Cura settings (*.ini)".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||||
curaButton.CheckedStateChanged += (s, e) => exportMode = "cura";
|
curaButton.CheckedStateChanged += (s, e) => exportMode = "cura";
|
||||||
container.AddChild(curaButton);
|
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
|
#endif
|
||||||
|
|
||||||
var exportButton = textImageButtonFactory.Generate("Export Settings".Localize());
|
var exportButton = textImageButtonFactory.Generate("Export Settings".Localize());
|
||||||
|
|
@ -74,6 +93,23 @@ namespace MatterHackers.MatterControl
|
||||||
footerRow.AddChild(cancelButton);
|
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()
|
private void exportButton_Click()
|
||||||
{
|
{
|
||||||
WizardWindow.Close();
|
WizardWindow.Close();
|
||||||
|
|
|
||||||
|
|
@ -46,28 +46,56 @@ namespace MatterHackers.MatterControl
|
||||||
public ImportSettingsPage() :
|
public ImportSettingsPage() :
|
||||||
base("Cancel")
|
base("Cancel")
|
||||||
{
|
{
|
||||||
var container = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
var container = new FlowLayoutWidget(FlowDirection.TopToBottom)
|
||||||
|
{
|
||||||
|
HAnchor = HAnchor.ParentLeftRight,
|
||||||
|
};
|
||||||
contentRow.AddChild(container);
|
contentRow.AddChild(container);
|
||||||
|
|
||||||
|
// add new profile
|
||||||
var newPrinterButton = new RadioButton("Import as new printer profile".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
var newPrinterButton = new RadioButton("Import as new printer profile".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||||
newPrinterButton.CheckedStateChanged += (s, e) => importMode = "new";
|
newPrinterButton.CheckedStateChanged += (s, e) => importMode = "new";
|
||||||
newPrinterButton.Checked = true;
|
newPrinterButton.Checked = true;
|
||||||
container.AddChild(newPrinterButton);
|
container.AddChild(newPrinterButton);
|
||||||
this.importMode = "new";
|
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);
|
var mergeButton = new RadioButton("Merge into current printer profile".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||||
mergeButton.CheckedStateChanged += (s, e) => importMode = "merge";
|
mergeButton.CheckedStateChanged += (s, e) => importMode = "merge";
|
||||||
container.AddChild(mergeButton);
|
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);
|
var replaceButton = new RadioButton("Replace current printer profile".Localize(), textColor: ActiveTheme.Instance.PrimaryTextColor);
|
||||||
replaceButton.CheckedStateChanged += (s, e) => importMode = "replace";
|
replaceButton.CheckedStateChanged += (s, e) => importMode = "replace";
|
||||||
container.AddChild(replaceButton);
|
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());
|
var importButton = textImageButtonFactory.Generate("Import Settings".Localize());
|
||||||
importButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
importButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||||
{
|
{
|
||||||
FileDialog.OpenFileDialog(
|
FileDialog.OpenFileDialog(
|
||||||
new OpenFileDialogParams("settings files|*.ini;*.printer,"),
|
new OpenFileDialogParams("settings files|*.ini;*.printer;*.slice"),
|
||||||
(dialogParams) => ImportSettingsFile(dialogParams.FileName));
|
(dialogParams) => ImportSettingsFile(dialogParams.FileName));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -80,6 +108,23 @@ namespace MatterHackers.MatterControl
|
||||||
footerRow.AddChild(cancelButton);
|
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)
|
private void ImportSettingsFile(string settingsFilePath)
|
||||||
{
|
{
|
||||||
WizardWindow.Close();
|
WizardWindow.Close();
|
||||||
|
|
@ -94,6 +139,10 @@ namespace MatterHackers.MatterControl
|
||||||
case "replace":
|
case "replace":
|
||||||
ReplaceOrMergeSettings(settingsFilePath);
|
ReplaceOrMergeSettings(settingsFilePath);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "qualityPreset":
|
||||||
|
throw new NotImplementedException("import to preset");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,8 @@
|
||||||
"QuickMenuSettings": [],
|
"QuickMenuSettings": [],
|
||||||
"SetSettingsOnChange": [],
|
"SetSettingsOnChange": [],
|
||||||
"SlicerConfigName": "layer_to_pause",
|
"SlicerConfigName": "layer_to_pause",
|
||||||
"PresentationName": "Select Layer To Pause:",
|
"PresentationName": "Layers To Pause:",
|
||||||
"HelpText": "If you want to select a layer to pause your print on do so here (for changing filament)",
|
"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",
|
"DataEditType": "STRING",
|
||||||
"ExtraSettings": "",
|
"ExtraSettings": "",
|
||||||
"ShowAsOverride": true,
|
"ShowAsOverride": true,
|
||||||
|
|
|
||||||
|
|
@ -4996,3 +4996,12 @@ Translated:Replace current printer profile
|
||||||
English:Import Settings
|
English:Import Settings
|
||||||
Translated: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
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue