Put in a enable retract setting
Made slice settings disable work
This commit is contained in:
parent
e98e0d00b8
commit
d3e7d00b3e
9 changed files with 92 additions and 20 deletions
|
|
@ -120,6 +120,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
public const string write_regex = nameof(write_regex);
|
||||
public const string read_regex = nameof(read_regex);
|
||||
public const string temperature = nameof(temperature);
|
||||
public const string enable_retractions = nameof(enable_retractions);
|
||||
public const string use_z_probe = nameof(use_z_probe);
|
||||
public const string z_probe_samples = nameof(z_probe_samples);
|
||||
public const string has_z_probe = nameof(has_z_probe);
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public string ShowIfSet { get; set; }
|
||||
|
||||
public string EnableIfSet { get; set; }
|
||||
|
||||
public string DefaultValue { get; set; }
|
||||
|
||||
public DataEditTypes DataEditType { get; set; }
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
foreach (SliceSettingData settingData in subGroup.SettingDataList)
|
||||
{
|
||||
// Note: tab sections may disappear if they when they are empty, as controlled by:
|
||||
// Note: tab sections may disappear if / when they are empty, as controlled by:
|
||||
// settingShouldBeShown / addedSettingToSubGroup / needToAddSubGroup
|
||||
bool settingShouldBeShown = CheckIfShouldBeShown(settingData);
|
||||
|
||||
|
|
@ -538,6 +538,12 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
return settingShouldBeShown;
|
||||
}
|
||||
|
||||
private bool CheckIfEnabled(SliceSettingData settingData)
|
||||
{
|
||||
bool shouldBeEnabled = ActiveSliceSettings.Instance.ParseShowString(settingData.EnableIfSet, layerCascade);
|
||||
return shouldBeEnabled;
|
||||
}
|
||||
|
||||
private GuiWidget AddInHelpText(FlowLayoutWidget topToBottomSettings, SliceSettingData settingData)
|
||||
{
|
||||
FlowLayoutWidget allText = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||
|
|
@ -1617,6 +1623,29 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
// Invoke the UpdateStyle implementation
|
||||
settingsRow.UpdateStyle();
|
||||
|
||||
bool settingShouldEnabled = ActiveSliceSettings.Instance.ParseShowString(settingData.EnableIfSet, layerCascade);
|
||||
if (!settingShouldEnabled)
|
||||
{
|
||||
var holder = new GuiWidget()
|
||||
{
|
||||
VAnchor = VAnchor.FitToChildren,
|
||||
HAnchor = HAnchor.ParentLeftRight
|
||||
};
|
||||
|
||||
holder.AddChild(settingsRow);
|
||||
|
||||
var disable = new GuiWidget()
|
||||
{
|
||||
VAnchor = VAnchor.ParentBottomTop,
|
||||
HAnchor = HAnchor.ParentLeftRight,
|
||||
};
|
||||
disable.BackgroundColor = new RGBA_Bytes(ActiveTheme.Instance.TertiaryBackgroundColor, 200);
|
||||
|
||||
holder.AddChild(disable);
|
||||
|
||||
return holder;
|
||||
}
|
||||
|
||||
return settingsRow;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
SettingsKey.recover_position_before_z_home,
|
||||
SettingsKey.resume_gcode,
|
||||
SettingsKey.temperature,
|
||||
SettingsKey.enable_retractions,
|
||||
"z_homes_to_max",
|
||||
|
||||
// TODO: merge the items below into the list above after some validation - setting that weren't previously mapped to Cura but probably should be.
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
new GCodeForSlicer(SettingsKey.end_gcode, "endCode"),
|
||||
new GCodeForSlicer("toolchange_gcode", "toolChangeCode"),
|
||||
new MapFirstValue("retract_before_travel", "minimumTravelToCauseRetraction"),
|
||||
new MapFirstValue("retract_length", "retractionOnTravel"),
|
||||
new RetractionLength("retract_length", "retractionOnTravel"),
|
||||
new MapFirstValue("retract_lift", "retractionZHop"),
|
||||
new MapFirstValue("retract_restart_extra", "unretractExtraExtrusion"),
|
||||
new MapFirstValue("retract_restart_extra_time_to_apply", "retractRestartExtraTimeToApply"),
|
||||
|
|
|
|||
|
|
@ -497,6 +497,29 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
}
|
||||
}
|
||||
|
||||
public class RetractionLength : MappedSetting
|
||||
{
|
||||
public RetractionLength(string canonicalSettingsName, string exportedName)
|
||||
: base(canonicalSettingsName, exportedName)
|
||||
{
|
||||
}
|
||||
|
||||
public override string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
if(ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.enable_retractions))
|
||||
{
|
||||
return base.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class AsPercentOfReferenceOrDirect : MappedSetting
|
||||
{
|
||||
string originalReference;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue