Merge pull request #697 from jlewin/master
Clean up kvp use, add ComPort setting, hookup Add Printer
This commit is contained in:
commit
49958fd300
9 changed files with 35 additions and 23 deletions
|
|
@ -29,7 +29,9 @@ either expressed or implied, of the FreeBSD Project.
|
||||||
|
|
||||||
using MatterHackers.Agg.ImageProcessing;
|
using MatterHackers.Agg.ImageProcessing;
|
||||||
using MatterHackers.Agg.PlatformAbstract;
|
using MatterHackers.Agg.PlatformAbstract;
|
||||||
|
using MatterHackers.Agg.UI;
|
||||||
using MatterHackers.Localizations;
|
using MatterHackers.Localizations;
|
||||||
|
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
|
||||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||||
|
|
||||||
namespace MatterHackers.MatterControl
|
namespace MatterHackers.MatterControl
|
||||||
|
|
@ -62,7 +64,7 @@ namespace MatterHackers.MatterControl
|
||||||
}
|
}
|
||||||
else if(this.SelectedValue == "new")
|
else if(this.SelectedValue == "new")
|
||||||
{
|
{
|
||||||
int a = 0;
|
UiThread.RunOnIdle(ConnectionWizard.Show);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1315,16 +1315,16 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
||||||
|
|
||||||
// TODO: Shouldn't this logic be in the UI layer where the controls are owned and hooked in via PrintFinished?
|
// TODO: Shouldn't this logic be in the UI layer where the controls are owned and hooked in via PrintFinished?
|
||||||
bool oneOrMoreValuesReset = false;
|
bool oneOrMoreValuesReset = false;
|
||||||
foreach (var kvp in ActiveSliceSettings.Instance.BaseLayer)
|
foreach (var keyValue in ActiveSliceSettings.Instance.BaseLayer)
|
||||||
{
|
{
|
||||||
string currentValue = ActiveSliceSettings.Instance.ActiveValue(kvp.Key);
|
string currentValue = ActiveSliceSettings.Instance.ActiveValue(keyValue.Key);
|
||||||
|
|
||||||
bool valueIsClear = currentValue == "0" | currentValue == "";
|
bool valueIsClear = currentValue == "0" | currentValue == "";
|
||||||
OrganizerSettingsData data = SliceSettingsOrganizer.Instance.GetSettingsData(kvp.Key);
|
OrganizerSettingsData data = SliceSettingsOrganizer.Instance.GetSettingsData(keyValue.Key);
|
||||||
if (data?.ResetAtEndOfPrint == true && !valueIsClear)
|
if (data?.ResetAtEndOfPrint == true && !valueIsClear)
|
||||||
{
|
{
|
||||||
oneOrMoreValuesReset = true;
|
oneOrMoreValuesReset = true;
|
||||||
ActiveSliceSettings.Instance.ClearValue(kvp.Key);
|
ActiveSliceSettings.Instance.ClearValue(keyValue.Key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -622,10 +622,10 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
{
|
{
|
||||||
var bigStringForHashCode = new StringBuilder();
|
var bigStringForHashCode = new StringBuilder();
|
||||||
|
|
||||||
foreach (var kvp in this.BaseLayer)
|
foreach (var keyValue in this.BaseLayer)
|
||||||
{
|
{
|
||||||
string activeValue = ActiveValue(kvp.Key);
|
string activeValue = ActiveValue(keyValue.Key);
|
||||||
bigStringForHashCode.Append(kvp.Key);
|
bigStringForHashCode.Append(keyValue.Key);
|
||||||
bigStringForHashCode.Append(activeValue);
|
bigStringForHashCode.Append(activeValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -638,14 +638,14 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
{
|
{
|
||||||
using (var outstream = new StreamWriter(fileName))
|
using (var outstream = new StreamWriter(fileName))
|
||||||
{
|
{
|
||||||
foreach (var kvp in this.BaseLayer)
|
foreach (var keyValue in this.BaseLayer)
|
||||||
{
|
{
|
||||||
string activeValue = ActiveValue(kvp.Key);
|
string activeValue = ActiveValue(keyValue.Key);
|
||||||
if (replaceMacroValues)
|
if (replaceMacroValues)
|
||||||
{
|
{
|
||||||
activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
|
activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
|
||||||
}
|
}
|
||||||
outstream.Write(string.Format("{0} = {1}\n", kvp.Key, activeValue));
|
outstream.Write(string.Format("{0} = {1}\n", keyValue.Key, activeValue));
|
||||||
activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
|
activeValue = GCodeProcessing.ReplaceMacroValues(activeValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1028,9 +1028,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
|
|
||||||
public SettingsLayer(Dictionary<string, string> settingsDictionary)
|
public SettingsLayer(Dictionary<string, string> settingsDictionary)
|
||||||
{
|
{
|
||||||
foreach(var kvp in settingsDictionary)
|
foreach(var keyValue in settingsDictionary)
|
||||||
{
|
{
|
||||||
this[kvp.Key] = kvp.Value;
|
this[keyValue.Key] = keyValue.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -304,31 +304,31 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
{
|
{
|
||||||
if (line.Length > 0)
|
if (line.Length > 0)
|
||||||
{
|
{
|
||||||
|
string sanitizedLine = line.Replace('"', ' ').Trim();
|
||||||
switch (CountLeadingSpaces(line))
|
switch (CountLeadingSpaces(line))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
string userLevelText = line.Replace('"', ' ').Trim();
|
userLevelToAddTo = new OrganizerUserLevel(sanitizedLine);
|
||||||
userLevelToAddTo = new OrganizerUserLevel(userLevelText);
|
UserLevels.Add(sanitizedLine, userLevelToAddTo);
|
||||||
UserLevels.Add(userLevelText, userLevelToAddTo);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
categoryToAddTo = new OrganizerCategory(line.Replace('"', ' ').Trim());
|
categoryToAddTo = new OrganizerCategory(sanitizedLine);
|
||||||
userLevelToAddTo.CategoriesList.Add(categoryToAddTo);
|
userLevelToAddTo.CategoriesList.Add(categoryToAddTo);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
groupToAddTo = new OrganizerGroup(line.Replace('"', ' ').Trim());
|
groupToAddTo = new OrganizerGroup(sanitizedLine);
|
||||||
categoryToAddTo.GroupsList.Add(groupToAddTo);
|
categoryToAddTo.GroupsList.Add(groupToAddTo);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
subGroupToAddTo = new OrganizerSubGroup(line.Replace('"', ' ').Trim());
|
subGroupToAddTo = new OrganizerSubGroup(sanitizedLine);
|
||||||
groupToAddTo.SubGroupsList.Add(subGroupToAddTo);
|
groupToAddTo.SubGroupsList.Add(subGroupToAddTo);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 8:
|
case 8:
|
||||||
OrganizerSettingsData data = GetSettingsData(line.Replace('"', ' ').Trim());
|
OrganizerSettingsData data = GetSettingsData(sanitizedLine);
|
||||||
if (data != null)
|
if (data != null)
|
||||||
{
|
{
|
||||||
subGroupToAddTo.SettingDataList.Add(data);
|
subGroupToAddTo.SettingDataList.Add(data);
|
||||||
|
|
|
||||||
|
|
@ -521,11 +521,11 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
FlowLayoutWidget topToBottomSettings = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||||
topToBottomSettings.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
|
topToBottomSettings.HAnchor = Agg.UI.HAnchor.Max_FitToChildren_ParentWidth;
|
||||||
|
|
||||||
foreach (var kvp in ActiveSliceSettings.Instance.BaseLayer)
|
foreach (var keyValue in ActiveSliceSettings.Instance.BaseLayer)
|
||||||
{
|
{
|
||||||
if (!SliceSettingsOrganizer.Instance.Contains(UserLevel, kvp.Key))
|
if (!SliceSettingsOrganizer.Instance.Contains(UserLevel, keyValue.Key))
|
||||||
{
|
{
|
||||||
OrganizerSettingsData settingInfo = new OrganizerSettingsData(kvp.Key, kvp.Key, OrganizerSettingsData.DataEditTypes.STRING);
|
OrganizerSettingsData settingInfo = new OrganizerSettingsData(keyValue.Key, keyValue.Key, OrganizerSettingsData.DataEditTypes.STRING);
|
||||||
if (ActiveSliceSettings.Instance.ActiveSliceEngine().MapContains(settingInfo.SlicerConfigName))
|
if (ActiveSliceSettings.Instance.ActiveSliceEngine().MapContains(settingInfo.SlicerConfigName))
|
||||||
{
|
{
|
||||||
GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, rightContentWidth, 0);
|
GuiWidget controlsForThisSetting = CreateSettingInfoUIControls(settingInfo, rightContentWidth, 0);
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
"has_power_control",
|
"has_power_control",
|
||||||
"has_sd_card_reader",
|
"has_sd_card_reader",
|
||||||
"MatterControl.BaudRate",
|
"MatterControl.BaudRate",
|
||||||
|
"MatterControl.ComPort",
|
||||||
"manual_probe_paper_width",
|
"manual_probe_paper_width",
|
||||||
"pause_gcode",
|
"pause_gcode",
|
||||||
"print_leveling_method",
|
"print_leveling_method",
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ layer_gcode = ; LAYER:[layer_num]
|
||||||
layer_height = 0.4
|
layer_height = 0.4
|
||||||
layer_to_pause =
|
layer_to_pause =
|
||||||
MatterControl.BaudRate = 250000
|
MatterControl.BaudRate = 250000
|
||||||
|
MatterControl.ComPort =
|
||||||
max_fan_speed = 100
|
max_fan_speed = 100
|
||||||
min_extrusion_before_retract = .1
|
min_extrusion_before_retract = .1
|
||||||
min_fan_speed = 35
|
min_fan_speed = 35
|
||||||
|
|
|
||||||
|
|
@ -275,6 +275,7 @@ Advanced
|
||||||
z_homes_to_max
|
z_homes_to_max
|
||||||
Firmware
|
Firmware
|
||||||
MatterControl.BaudRate
|
MatterControl.BaudRate
|
||||||
|
MatterControl.ComPort
|
||||||
z_can_be_negative
|
z_can_be_negative
|
||||||
gcode_flavor
|
gcode_flavor
|
||||||
use_relative_e_distances
|
use_relative_e_distances
|
||||||
|
|
|
||||||
|
|
@ -1223,6 +1223,13 @@
|
||||||
"DataEditType": "INT",
|
"DataEditType": "INT",
|
||||||
"ExtraSettings": ""
|
"ExtraSettings": ""
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"SlicerConfigName": "MatterControl.ComPort",
|
||||||
|
"PresentationName": "ComPort",
|
||||||
|
"HelpText": "",
|
||||||
|
"DataEditType": "STRING",
|
||||||
|
"ExtraSettings": ""
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"SlicerConfigName": "vibration_limit",
|
"SlicerConfigName": "vibration_limit",
|
||||||
"PresentationName": "Vibration Limit",
|
"PresentationName": "Vibration Limit",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue