Merge pull request #4940 from larsbrubaker/master

Adding in the ability to change the settings detail
This commit is contained in:
Lars Brubaker 2020-12-29 09:18:30 -08:00 committed by GitHub
commit 23df72aa6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 616 additions and 13414 deletions

View file

@ -124,6 +124,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
SettingsKey.emulate_endstops,
SettingsKey.enable_line_splitting,
SettingsKey.enable_network_printing,
SettingsKey.create_skirt,
SettingsKey.create_raft,
SettingsKey.create_brim,
SettingsKey.enable_retractions,
SettingsKey.enable_sailfish_communication,
SettingsKey.filament_cost,

View file

@ -37,84 +37,47 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
public class SettingsLayout
{
private Dictionary<string, SettingsSection> Sections { get; set; } = new Dictionary<string, SettingsSection>();
public SettingsSection Simple { get; } = new SettingsSection("Simple");
public SettingsSection SliceSettings => Sections["Advanced"];
public SettingsSection Moderate { get; } = new SettingsSection("Moderate");
public SettingsSection Printer => Sections["Printer"];
public SettingsSection Advanced { get; } = new SettingsSection("Advanced");
public SettingsSection Printer { get; } = new SettingsSection("Printer");
internal SettingsLayout()
{
LoadAndParseLayoutFile();
LoadAndParseLayoutFile(Simple, SliceSettingsLayouts.SimpleSettings());
LoadAndParseLayoutFile(Moderate, SliceSettingsLayouts.ModerateSettings());
LoadAndParseLayoutFile(Advanced, SliceSettingsLayouts.AdvancedSettings());
LoadAndParseLayoutFile(Printer, SliceSettingsLayouts.PrinterSettings());
}
public bool Contains(string sectionKey, string slicerConfigName)
private void LoadAndParseLayoutFile(SettingsSection section, (string categoryName, (string groupName, string[] settings)[] groups)[] layout)
{
if (this.Sections.TryGetValue(sectionKey, out SettingsSection section))
foreach (var (categoryName, groups) in layout)
{
return section.ContainsKey(slicerConfigName);
}
var categoryToAddTo = new Category(categoryName, section);
section.Categories.Add(categoryToAddTo);
return false;
}
private void LoadAndParseLayoutFile()
{
SettingsSection sectionToAddTo = null;
Category categoryToAddTo = null;
Group groupToAddTo = null;
foreach (string line in StaticData.Instance.ReadAllLines(Path.Combine("SliceSettings", "Layouts.txt")))
{
if (line.Length > 0)
foreach (var (groupName, settings) in groups)
{
string sanitizedLine = line.Replace('"', ' ').Trim();
var leadingSpaces = CountLeadingSpaces(line);
switch (leadingSpaces)
var groupToAddTo = new Group(groupName, categoryToAddTo);
categoryToAddTo.Groups.Add(groupToAddTo);
foreach (var setting in settings)
{
case 0:
sectionToAddTo = new SettingsSection(sanitizedLine);
Sections.Add(sanitizedLine, sectionToAddTo);
break;
case 2:
categoryToAddTo = new Category(sanitizedLine, sectionToAddTo);
sectionToAddTo.Categories.Add(categoryToAddTo);
break;
case 4:
groupToAddTo = new Group(sanitizedLine, categoryToAddTo);
categoryToAddTo.Groups.Add(groupToAddTo);
break;
case 6:
if (PrinterSettings.SettingsData.TryGetValue(sanitizedLine, out SliceSettingData data))
{
groupToAddTo.Settings.Add(data);
data.OrganizerGroup = groupToAddTo;
sectionToAddTo.AddSetting(data.SlicerConfigName, groupToAddTo);
}
break;
default:
throw new Exception($"Bad file, too many spaces - {leadingSpaces} (must be 0, 2, 4 or 6).");
if (PrinterSettings.SettingsData.TryGetValue(setting, out SliceSettingData data))
{
groupToAddTo.Settings.Add(data);
data.OrganizerGroup = groupToAddTo;
section.AddSetting(data.SlicerConfigName, groupToAddTo);
}
}
}
}
}
private static int CountLeadingSpaces(string line)
{
int numSpaces = 0;
while (line[numSpaces] == ' ' && numSpaces < line.Length)
{
numSpaces++;
}
return numSpaces;
}
/// <summary>
/// This is the 'Slice Settings' or the 'Printer' settings sections
/// </summary>

View file

@ -343,7 +343,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
PresentationName = "Create Raft".Localize(),
HelpText = "Creates a raft under the printed part. Useful to prevent warping when printing ABS (and other warping-prone plastics) as it helps parts adhere to the bed.".Localize(),
DataEditType = DataEditTypes.CHECK_BOX,
ShowIfSet = "NEVER_SHOW",
DefaultValue = "0",
ReloadUiWhenChanged = true,
Converter = new MappedToBoolString(),

View file

@ -0,0 +1,496 @@
/*
Copyright (c) 2019, Lars Brubaker, John Lewin
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
namespace MatterHackers.MatterControl.SlicerConfiguration
{
public static class SliceSettingsLayouts
{
public static (string categoryName, (string groupName, string[] settings)[] groups)[] SimpleSettings()
{
var settings = new[]
{
("General", new[]
{
("General", new[]
{
SettingsKey.layer_height,
SettingsKey.fill_density,
SettingsKey.create_skirt,
SettingsKey.create_raft,
SettingsKey.create_brim,
SettingsKey.create_per_layer_support,
SettingsKey.temperature,
SettingsKey.bed_temperature,
}),
("Advanced", new[]
{
SettingsKey.spiral_vase,
SettingsKey.layer_to_pause,
}),
}),
};
return settings;
}
public static (string categoryName, (string groupName, string[] settings)[] groups)[] ModerateSettings()
{
var settings = new[]
{
("General", new[]
{
("General", new[]
{
SettingsKey.layer_height,
SettingsKey.first_layer_height,
SettingsKey.perimeters,
SettingsKey.top_solid_layers,
SettingsKey.bottom_solid_layers,
SettingsKey.fill_density,
SettingsKey.infill_type
}),
("Layers / Surface", new[]
{
SettingsKey.avoid_crossing_perimeters,
SettingsKey.merge_overlapping_lines,
SettingsKey.expand_thin_walls,
}),
("Infill", new[]
{
SettingsKey.fill_angle,
SettingsKey.fill_thin_gaps,
}),
}),
("Speed", new[]
{
("Laser Speed", new[]
{
SettingsKey.laser_speed_025,
SettingsKey.laser_speed_100,
}),
("Infill Speeds", new[]
{
SettingsKey.first_layer_speed,
SettingsKey.infill_speed,
SettingsKey.top_solid_infill_speed,
}),
("Perimeter Speeds", new[]
{
SettingsKey.perimeter_speed,
SettingsKey.external_perimeter_speed,
}),
("Other Speeds", new[]
{
SettingsKey.support_material_speed,
SettingsKey.interface_layer_speed,
SettingsKey.bridge_speed,
SettingsKey.travel_speed,
}),
}),
("Adhesion", new[]
{
("Adhesion", new[]
{
SettingsKey.create_skirt,
SettingsKey.skirts,
SettingsKey.create_raft,
SettingsKey.create_brim,
SettingsKey.brims,
}),
}),
("Support", new[]
{
("Support", new[]
{
SettingsKey.create_per_layer_support,
SettingsKey.create_per_layer_internal_support,
SettingsKey.support_percent,
SettingsKey.support_material_create_perimeter,
SettingsKey.support_material_interface_layers,
SettingsKey.support_material_spacing,
SettingsKey.support_material_infill_angle,
SettingsKey.support_material_extruder,
SettingsKey.support_material_interface_extruder,
}),
}),
("Filament", new[]
{
("Filament", new[]
{
SettingsKey.temperature,
SettingsKey.temperature1,
SettingsKey.temperature2,
SettingsKey.temperature3,
SettingsKey.bed_temperature,
}),
("Fan", new[]
{
SettingsKey.disable_fan_first_layers,
SettingsKey.min_fan_speed_absolute,
}),
("Retraction", new[]
{
SettingsKey.retract_length,
SettingsKey.retract_lift,
}),
("Advanced", new[]
{
SettingsKey.extrusion_multiplier,
}),
}),
};
return settings;
}
public static (string categoryName, (string groupName, string[] settings)[] groups)[] AdvancedSettings()
{
var settings = new[]
{
("General", new[]
{
("General", new[]
{
SettingsKey.layer_height,
SettingsKey.first_layer_height,
SettingsKey.perimeters,
SettingsKey.top_solid_layers,
SettingsKey.bottom_solid_layers,
SettingsKey.fill_density,
SettingsKey.infill_type
}),
("Layers / Surface", new[]
{
SettingsKey.avoid_crossing_perimeters,
SettingsKey.avoid_crossing_max_ratio,
SettingsKey.external_perimeters_first,
SettingsKey.perimeter_start_end_overlap,
SettingsKey.merge_overlapping_lines,
SettingsKey.expand_thin_walls,
SettingsKey.coast_at_end_distance
}),
("Infill", new[]
{
SettingsKey.fill_angle,
SettingsKey.infill_overlap_perimeter,
SettingsKey.fill_thin_gaps,
}),
("Extruder Change", new[]
{
SettingsKey.wipe_shield_distance,
SettingsKey.wipe_tower_size,
}),
}),
("Speed", new[]
{
("Laser Speed", new[]
{
SettingsKey.laser_speed_025,
SettingsKey.laser_speed_100,
}),
("Infill Speeds", new[]
{
SettingsKey.first_layer_speed,
SettingsKey.infill_speed,
SettingsKey.top_solid_infill_speed,
SettingsKey.raft_print_speed,
}),
("Perimeter Speeds", new[]
{
SettingsKey.perimeter_speed,
SettingsKey.external_perimeter_speed,
SettingsKey.perimeter_acceleration,
SettingsKey.default_acceleration,
}),
("Other Speeds", new[]
{
SettingsKey.support_material_speed,
SettingsKey.interface_layer_speed,
SettingsKey.air_gap_speed,
SettingsKey.bridge_speed,
SettingsKey.travel_speed,
SettingsKey.number_of_first_layers,
SettingsKey.bridge_over_infill,
SettingsKey.t1_extrusion_move_speed_multiplier,
}),
("Cooling", new[]
{
SettingsKey.slowdown_below_layer_time,
SettingsKey.min_print_speed,
}),
}),
("Adhesion", new[]
{
("Skirt", new[]
{
SettingsKey.create_skirt,
SettingsKey.skirts,
SettingsKey.skirt_distance,
SettingsKey.min_skirt_length,
}),
("Raft", new[]
{
SettingsKey.create_raft,
SettingsKey.raft_extra_distance_around_part,
SettingsKey.raft_air_gap,
SettingsKey.raft_extruder,
}),
("Brim", new[]
{
SettingsKey.create_brim,
SettingsKey.brims,
}),
}),
("Support", new[]
{
("Support", new[]
{
SettingsKey.create_per_layer_support,
SettingsKey.create_per_layer_internal_support,
SettingsKey.support_percent,
SettingsKey.support_grab_distance,
SettingsKey.support_material_create_perimeter,
SettingsKey.support_material_interface_layers,
SettingsKey.support_material_xy_distance,
SettingsKey.support_air_gap,
SettingsKey.support_type,
SettingsKey.support_material_spacing,
SettingsKey.support_material_infill_angle,
SettingsKey.support_material_extruder,
SettingsKey.support_material_interface_extruder,
}),
}),
("Filament", new[]
{
("Filament", new[]
{
SettingsKey.filament_diameter,
SettingsKey.filament_density,
SettingsKey.filament_cost,
SettingsKey.temperature,
SettingsKey.temperature1,
SettingsKey.temperature2,
SettingsKey.temperature3,
SettingsKey.bed_temperature,
SettingsKey.inactive_cool_down,
SettingsKey.seconds_to_reheat,
}),
("Fan", new[]
{
SettingsKey.min_fan_speed_layer_time,
SettingsKey.max_fan_speed_layer_time,
SettingsKey.min_fan_speed,
SettingsKey.max_fan_speed,
SettingsKey.bridge_fan_speed,
SettingsKey.disable_fan_first_layers,
SettingsKey.min_fan_speed_absolute,
}),
("Retraction", new[]
{
SettingsKey.retract_length,
SettingsKey.retract_restart_extra,
SettingsKey.retract_restart_extra_time_to_apply,
SettingsKey.retract_speed,
SettingsKey.retract_lift,
SettingsKey.retract_before_travel,
SettingsKey.retract_before_travel_avoid,
SettingsKey.retract_when_changing_islands,
SettingsKey.min_extrusion_before_retract,
SettingsKey.retract_length_tool_change,
SettingsKey.retract_restart_extra_toolchange,
}),
("Advanced", new[]
{
SettingsKey.extruder_wipe_temperature,
SettingsKey.bed_remove_part_temperature,
SettingsKey.extrusion_multiplier,
SettingsKey.first_layer_extrusion_width,
SettingsKey.external_perimeter_extrusion_width,
}),
}),
};
return settings;
}
public static (string categoryName, (string groupName, string[] settings)[] groups)[] PrinterSettings()
{
var printerSettings = new (string categoryName, (string groupName, string[] settings)[] groups)[]
{
("General", new[]
{
("General", new[]
{
SettingsKey.make,
SettingsKey.model,
SettingsKey.auto_connect,
SettingsKey.baud_rate,
SettingsKey.com_port,
SettingsKey.selector_ip_address,
SettingsKey.ip_address,
SettingsKey.ip_port,
}),
("Bed", new[]
{
SettingsKey.bed_size,
SettingsKey.print_center,
SettingsKey.build_height,
SettingsKey.bed_shape,
}),
("Extruders", new[]
{
SettingsKey.extruder_count,
SettingsKey.nozzle_diameter,
SettingsKey.t0_inset,
SettingsKey.t1_inset,
SettingsKey.extruders_share_temperature,
SettingsKey.extruder_offset,
}),
}),
("Features", new (string groupName, string[] settings)[]
{
("Leveling", new[]
{
SettingsKey.print_leveling_solution,
SettingsKey.leveling_sample_points,
SettingsKey.probe_offset_sample_point,
SettingsKey.print_leveling_required_to_print,
}),
("Print Recovery", new[]
{
SettingsKey.recover_is_enabled,
SettingsKey.recover_first_layer_speed,
SettingsKey.recover_position_before_z_home,
}),
("Probe", new[]
{
SettingsKey.print_leveling_probe_start,
SettingsKey.use_z_probe,
SettingsKey.validate_leveling,
SettingsKey.validation_threshold,
SettingsKey.z_probe_samples,
SettingsKey.probe_offset,
SettingsKey.z_servo_depolyed_angle,
SettingsKey.z_servo_retracted_angle,
}),
("Behavior", new[]
{
SettingsKey.slice_engine,
SettingsKey.heat_extruder_before_homing,
SettingsKey.auto_release_motors,
SettingsKey.validate_layer_height,
SettingsKey.emulate_endstops,
SettingsKey.send_with_checksum,
SettingsKey.reset_long_extrusion,
SettingsKey.output_only_first_layer,
SettingsKey.g0,
SettingsKey.progress_reporting,
SettingsKey.include_firmware_updater,
SettingsKey.backup_firmware_before_update,
}),
("Diagnostics", new[]
{
SettingsKey.report_runout_sensor_data,
}),
("Hardware", new[]
{
SettingsKey.firmware_type,
SettingsKey.show_reset_connection,
SettingsKey.z_homes_to_max,
SettingsKey.has_fan,
SettingsKey.has_fan_per_extruder,
SettingsKey.has_hardware_leveling,
SettingsKey.has_heated_bed,
SettingsKey.has_sd_card_reader,
SettingsKey.has_power_control,
SettingsKey.filament_runout_sensor,
SettingsKey.runout_sensor_check_distance,
SettingsKey.runout_sensor_trigger_ratio,
SettingsKey.has_z_probe,
SettingsKey.has_z_servo,
SettingsKey.has_c_axis,
SettingsKey.enable_network_printing,
SettingsKey.enable_sailfish_communication,
SettingsKey.sla_printer,
SettingsKey.max_acceleration,
SettingsKey.max_velocity,
SettingsKey.jerk_velocity,
SettingsKey.print_time_estimate_multiplier,
SettingsKey.load_filament_length,
SettingsKey.unload_filament_length,
SettingsKey.load_filament_speed,
}),
("Printer Help", new[]
{
SettingsKey.trim_filament_markdown,
SettingsKey.insert_filament_markdown2,
SettingsKey.running_clean_markdown2,
SettingsKey.insert_filament_1_markdown,
SettingsKey.running_clean_1_markdown,
SettingsKey.created_date,
}),
}),
("G-Code", new[]
{
("Printer Control", new[]
{
SettingsKey.start_gcode,
SettingsKey.end_gcode,
SettingsKey.layer_gcode,
SettingsKey.connect_gcode,
}),
("User Control", new[]
{
SettingsKey.cancel_gcode,
SettingsKey.pause_gcode,
SettingsKey.resume_gcode,
}),
("Multi-Extruder", new[]
{
SettingsKey.before_toolchange_gcode,
SettingsKey.toolchange_gcode,
SettingsKey.before_toolchange_gcode_1,
SettingsKey.toolchange_gcode_1,
SettingsKey.before_toolchange_gcode_2,
SettingsKey.toolchange_gcode_2,
SettingsKey.before_toolchange_gcode_3,
SettingsKey.toolchange_gcode_3,
}),
("Filters", new[]
{
SettingsKey.write_regex,
SettingsKey.read_regex,
}),
}),
};
return printerSettings;
}
}
}

View file

@ -205,12 +205,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
exportPlugin.Initialize(printer);
var exportGCodeButton = menuTheme.CreateDialogButton("Export".Localize());
exportGCodeButton.Name = "Export Gcode Button";
exportGCodeButton.Enabled = exportPlugin.Enabled;
exportGCodeButton.ToolTipText = exportPlugin.Enabled ? exportType : exportPlugin.DisabledReason;
exportGCodeButton.Click += (s, e) =>
{
this.CloseMenu();
ExportPrintItemPage.DoExport(
new[] { new InMemoryLibraryItem(printer.Bed.Scene) },
printer,

View file

@ -59,19 +59,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public int EditButtonHeight { get; set; } = 44;
private Color[] selectionColors = new Color[] { new Color(131, 4, 66), new Color(227, 31, 61), new Color(255, 148, 1), new Color(247, 224, 23), new Color(143, 212, 1) };
private Stopwatch timeSinceLastSpin = new Stopwatch();
private Stopwatch timeSinceReported = new Stopwatch();
public Matrix4X4 TransformOnMouseDown { get; private set; } = Matrix4X4.Identity;
private TreeView treeView;
private readonly TreeView treeView;
private ViewStyleButton modelViewStyleButton;
private readonly ViewStyleButton modelViewStyleButton;
private PrinterConfig printer;
private readonly PrinterConfig printer;
private ThemeConfig theme;
private readonly ThemeConfig theme;
public Vector3 BedCenter
{
@ -89,7 +85,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public PrinterConfig Printer { get; private set; }
private PrinterTabPage printerTabPage;
private readonly PrinterTabPage printerTabPage;
public View3DWidget(PrinterConfig printer, ISceneContext sceneContext, ViewControls3D viewControls3D, ThemeConfig theme, PartTabPage printerTabBase, Object3DControlsLayer.EditorType editorType = Object3DControlsLayer.EditorType.Part)
{
@ -357,6 +353,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
this.RebuildTree();
}
if (sceneContext?.Scene?.SelectedItem != null)
{
UiThread.RunOnIdle(() =>
{
// make sure the selected item is still selected after reload
var currentItem = sceneContext.Scene.SelectedItem;
sceneContext.Scene.SelectedItem = null;
sceneContext.Scene.SelectedItem = currentItem;
});
}
}
private void GetNearFar(out double zNear, out double zFar)
@ -402,7 +409,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
private Dictionary<IObject3D, TreeNode> treeNodesByObject = new Dictionary<IObject3D, TreeNode>();
private readonly Dictionary<IObject3D, TreeNode> treeNodesByObject = new Dictionary<IObject3D, TreeNode>();
private bool watingToScroll = false;
@ -687,7 +694,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private GuiWidget topMostParent;
private PlaneShape bedPlane = new PlaneShape(Vector3.UnitZ, 0, null);
private readonly PlaneShape bedPlane = new PlaneShape(Vector3.UnitZ, 0, null);
public bool DragOperationActive { get; private set; }
@ -1278,7 +1285,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
if (!PositionWithinLocalBounds(localMousePosition.X, localMousePosition.Y))
{
Matrix4X4 totalTransform = Matrix4X4.CreateTranslation(new Vector3(-CurrentSelectInfo.LastMoveDelta));
var totalTransform = Matrix4X4.CreateTranslation(new Vector3(-CurrentSelectInfo.LastMoveDelta));
selectedItem.Matrix *= totalTransform;
CurrentSelectInfo.LastMoveDelta = Vector3.Zero;
Invalidate();
@ -1298,7 +1305,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// move the mesh back to the start position
{
Matrix4X4 totalTransform = Matrix4X4.CreateTranslation(new Vector3(-CurrentSelectInfo.LastMoveDelta));
var totalTransform = Matrix4X4.CreateTranslation(new Vector3(-CurrentSelectInfo.LastMoveDelta));
selectedItem.Matrix *= totalTransform;
}
@ -1352,7 +1359,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// move the mesh back to the new position
{
Matrix4X4 totalTransform = Matrix4X4.CreateTranslation(new Vector3(delta));
var totalTransform = Matrix4X4.CreateTranslation(new Vector3(delta));
selectedItem.Matrix *= totalTransform;
@ -1365,14 +1372,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
Vector2 OffsetToMeshViewerWidget()
{
List<GuiWidget> parents = new List<GuiWidget>();
var parents = new List<GuiWidget>();
GuiWidget parent = this.Object3DControlLayer.Parent;
while (parent != this)
{
parents.Add(parent);
parent = parent.Parent;
}
Vector2 offset = default(Vector2);
var offset = default(Vector2);
for (int i = parents.Count - 1; i >= 0; i--)
{
offset += parents[i].OriginRelativeParent;
@ -1438,8 +1445,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (ModifierKeys == Keys.Control)
{
// find the think we clicked on
var info = new IntersectInfo();
var hitObject = FindHitObject3D(mouseEvent.Position, out info);
var hitObject = FindHitObject3D(mouseEvent.Position, out IntersectInfo info);
if (hitObject != null)
{
if (selectedItem == hitObject
@ -1491,9 +1497,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
&& mouseDownPositon == mouseEvent.Position
&& this.TrackballTumbleWidget.FirstWidgetUnderMouse)
{
var info = new IntersectInfo();
if (FindHitObject3D(mouseEvent.Position, out info) is IObject3D hitObject
if (FindHitObject3D(mouseEvent.Position, out _) is IObject3D hitObject
&& (this.Printer == null // Allow Model -> Right Click in Part view
|| this.Printer?.ViewState.ViewMode == PartViewMode.Model)) // Disallow Model -> Right Click in GCode views
{
@ -1654,7 +1658,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
public static Regex fileNameNumberMatch = new Regex("\\(\\d+\\)", RegexOptions.Compiled);
private SelectedObjectPanel selectedObjectPanel;
private readonly SelectedObjectPanel selectedObjectPanel;
internal VerticalResizeContainer modelViewSidePanel;
@ -1677,10 +1681,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// popupMenu.CreateHorizontalLine();
}
private bool assigningTreeNode;
private FlowLayoutWidget treeNodeContainer;
private readonly bool assigningTreeNode;
private readonly FlowLayoutWidget treeNodeContainer;
private InlineStringEdit workspaceName;
private readonly InlineStringEdit workspaceName;
private int lastSceneDescendantsCount;
private Vector2 beforeReubildScrollPosition;

View file

@ -72,6 +72,7 @@ namespace MatterHackers.MatterControl
public const string SliceSettingsTabPinned = nameof(SliceSettingsTabPinned);
public const string SliceSettingsWidget_CurrentTab = nameof(SliceSettingsWidget_CurrentTab);
public const string SliceSettingsWidth = nameof(SliceSettingsWidth);
public const string SliceSettingsViewDetail = nameof(SliceSettingsViewDetail);
public const string SnapGridDistance = nameof(SnapGridDistance);
public const string SoftwareLicenseAccepted = nameof(SoftwareLicenseAccepted);
public const string TerminalAutoUppercase = nameof(TerminalAutoUppercase);

View file

@ -66,12 +66,28 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
this.AddChild(settingsControlBar);
var settingsSection = PrinterSettings.Layout.Simple;
switch (UserSettings.Instance.get(UserSettingsKey.SliceSettingsViewDetail))
{
case "Simple":
settingsSection = PrinterSettings.Layout.Simple;
break;
case "Moderate":
settingsSection = PrinterSettings.Layout.Moderate;
break;
case "Advanced":
settingsSection = PrinterSettings.Layout.Advanced;
break;
}
this.AddChild(
new SliceSettingsTabView(
settingsContext,
"SliceSettings",
printer,
PrinterSettings.Layout.SliceSettings,
settingsSection,
theme,
isPrimarySettingsView: true,
justMySettingsTitle: "My Modified Settings".Localize(),
@ -390,21 +406,42 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
this.ForceExpansionMode(ExpansionMode.Collapsed);
};
popupMenu.CreateSeparator();
popupMenu.CreateSubMenu("Settings Detail".Localize(),
theme,
(menu) =>
{
void SetDetail(string level, bool value)
{
UiThread.RunOnIdle(() =>
{
if (value)
{
UserSettings.Instance.set(UserSettingsKey.SliceSettingsViewDetail, level);
ApplicationController.Instance.ReloadAll().ConfigureAwait(false);
}
});
}
menu.CreateBoolMenuItem("Simple".Localize(),
() => UserSettings.Instance.get(UserSettingsKey.SliceSettingsViewDetail) == "Simple",
(value) => SetDetail("Simple", value));
menu.CreateBoolMenuItem("Moderate".Localize(),
() => UserSettings.Instance.get(UserSettingsKey.SliceSettingsViewDetail) == "Moderate",
(value) => SetDetail("Moderate", value));
menu.CreateBoolMenuItem("Advanced".Localize(),
() => UserSettings.Instance.get(UserSettingsKey.SliceSettingsViewDetail) == "Advanced",
(value) => SetDetail("Advanced", value));
});
externalExtendMenu?.Invoke(popupMenu);
}
public Dictionary<string, UIField> UIFields => allUiFields;
// Known sections which have toggle fields that enabled/disable said feature/section
private Dictionary<string, string> toggleSwitchSectionKeys = new Dictionary<string, string>
{
{ "Skirt", SettingsKey.create_skirt },
{ "Raft", SettingsKey.create_raft },
{ "Brim", SettingsKey.create_brim },
{ "Retraction", SettingsKey.enable_retractions },
{ "Fan", SettingsKey.enable_fan },
};
public SectionWidget CreateGroupSection(SettingsLayout.Group group, List<ValidationError> errors)
{
var groupPanel = new FlowLayoutWidget(FlowDirection.TopToBottom)
@ -423,12 +460,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
UIField uiField = null;
if (toggleSwitchSectionKeys.TryGetValue(group.Name, out string toggleFieldKey))
{
var settingData = PrinterSettings.SettingsData[toggleFieldKey];
uiField = CreateToggleFieldForSection(settingData);
}
var sectionName = group.Name.Localize();
var sectionWidget = new SectionWidget(sectionName, groupPanel, theme, serializationKey: userSettingsKey, rightAlignedContent: uiField?.Content);

@ -1 +1 @@
Subproject commit 6d8e0f06e08501c16b0943a64547ff50526c13da
Subproject commit 51477bb6954b01c6727031dd91362244357817c8

View file

@ -106,7 +106,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.SwitchToSliceSettings();
// Move to Adhesion tab
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.SliceSettings, "skirts");
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.Advanced, "skirts");
// Click Brim toggle field forcing ReloadAll
testRunner.WaitForReloadAll(() => testRunner.ClickByName("Create Brim Field"));

View file

@ -28,7 +28,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.AddItemToBedplate("", "Row Item Rook");
testRunner.SwitchToSliceSettings();
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.SliceSettings, SettingsKey.create_raft);
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.Advanced, SettingsKey.create_raft);
testRunner.WaitForReloadAll(() => testRunner.StartSlicing());
@ -382,17 +382,17 @@ namespace MatterHackers.MatterControl.Tests.Automation
var organizer = PrinterSettings.Layout;
var userLevel = organizer.SliceSettings;
var userLevel = organizer.Advanced;
Assert.IsNotNull(userLevel);
// Confirm expected keys
Assert.IsTrue(userLevel.ContainsKey("bed_temperature"));
Assert.IsTrue(organizer.Contains("Advanced", "bed_temperature"));
Assert.IsTrue(organizer.Contains("Printer", "extruder_count"));
Assert.IsTrue(organizer.Advanced.ContainsKey("bed_temperature"));
Assert.IsTrue(organizer.Printer.ContainsKey("extruder_count"));
// Confirm non-existent key
Assert.IsFalse(userLevel.ContainsKey("non_existing_setting"));
Assert.IsFalse(organizer.Contains("Advanced", "non_existing_setting"));
Assert.IsFalse(organizer.Advanced.ContainsKey("non_existing_setting"));
}
[Test /* Test will fail if screen size is and "HeatBeforeHoming" falls below the fold */]
@ -423,7 +423,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.SwitchToSliceSettings();
// Navigate to General Tab -> Layers / Surface Tab
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.SliceSettings, SettingsKey.layer_height);
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.Advanced, SettingsKey.layer_height);
Assert.AreEqual(0, layerHeightChangedCount, "No change to layer height yet.");
var theme = ApplicationController.Instance.Theme;
@ -537,8 +537,8 @@ namespace MatterHackers.MatterControl.Tests.Automation
// Navigate to Settings Tab and make sure Bed Temp Text box is visible
testRunner.SwitchToSliceSettings();
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.SliceSettings, SettingsKey.bed_temperature);
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.SliceSettings, SettingsKey.temperature);
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.Advanced, SettingsKey.bed_temperature);
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.Advanced, SettingsKey.temperature);
// Uncheck Has Heated Bed checkbox and make sure Bed Temp Textbox is not visible
testRunner.SwitchToPrinterSettings();
@ -547,7 +547,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
testRunner.Delay(.5);
testRunner.SwitchToSliceSettings();
testRunner.NavigateToSliceSettingsField(PrinterSettings.Layout.SliceSettings, SettingsKey.temperature);
testRunner.NavigateToSliceSettingsField(PrinterSettings.Layout.Advanced, SettingsKey.temperature);
Assert.IsFalse(testRunner.WaitForName("Bed Temperature Textbox", .5), "Filament -> Bed Temp should not be visible after Heated Bed unchecked");
// Make sure Bed Temperature Options are not visible in printer controls
@ -572,11 +572,11 @@ namespace MatterHackers.MatterControl.Tests.Automation
var printer = testRunner.FirstPrinter();
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.SliceSettings, "layer_height");
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.Advanced, "layer_height");
testRunner.Type(".5");
// Force lose focus
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.SliceSettings, "first_layer_height");
testRunner.SelectSliceSettingsField(PrinterSettings.Layout.Advanced, "first_layer_height");
testRunner.WaitFor(() => printer.Settings.GetValue<double>(SettingsKey.layer_height) == 0.5);
Assert.AreEqual(printer.Settings.GetValue<double>(SettingsKey.layer_height).ToString(), "0.5", "Layer height is what we set it to");

File diff suppressed because it is too large Load diff