From b8fc35de927ff8c725f3491f3769041f777e90a5 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Tue, 28 Feb 2017 15:56:10 -0800 Subject: [PATCH 1/2] Display make/model in settings --- SlicerConfiguration/SliceSettingsWidget.cs | 66 +++++++++++++++------- 1 file changed, 47 insertions(+), 19 deletions(-) diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index eda9edde2..0b15402da 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -489,7 +489,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration if(group.Name == "Connection") { - subGroupLayoutTopToBottom.AddChild(SliceSettingsWidget.CreatePrinterExtraControls()); + subGroupLayoutTopToBottom.AddChild(SliceSettingsWidget.CreatePrinterExtraControls(isPrimaryView: true)); } } @@ -718,39 +718,67 @@ namespace MatterHackers.MatterControl.SlicerConfiguration return ActiveSliceSettings.Instance.GetValue(slicerConfigName, layerCascade); } - public static GuiWidget CreatePrinterExtraControls() + public static GuiWidget CreatePrinterExtraControls(bool isPrimaryView = false) { var dataArea = new FlowLayoutWidget(FlowDirection.TopToBottom) { HAnchor = HAnchor.ParentLeftRight, }; - // OEM_LAYER_DATE: - string lastUpdateTime = "March 1, 2016"; - if (ActiveSliceSettings.Instance?.OemLayer != null) + if (isPrimaryView) { - string fromCreatedDate = ActiveSliceSettings.Instance.OemLayer.ValueOrDefault(SettingsKey.created_date); - try + // OEM_LAYER_DATE: + string lastUpdateTime = "March 1, 2016"; + if (ActiveSliceSettings.Instance?.OemLayer != null) { - if (!string.IsNullOrEmpty(fromCreatedDate)) + string fromCreatedDate = ActiveSliceSettings.Instance.OemLayer.ValueOrDefault(SettingsKey.created_date); + try + { + if (!string.IsNullOrEmpty(fromCreatedDate)) + { + DateTime time = Convert.ToDateTime(fromCreatedDate).ToLocalTime(); + lastUpdateTime = time.ToString("MMMM d, yyyy h:mm tt"); + } + } + catch { - DateTime time = Convert.ToDateTime(fromCreatedDate).ToLocalTime(); - lastUpdateTime = time.ToString("MMMM d, yyyy ") + time.ToString("h:mm tt"); } } - catch + + var row = new FlowLayoutWidget() { + BackgroundColor = ActiveTheme.Instance.TertiaryBackgroundColor, + Padding = new BorderDouble(5), + Margin = new BorderDouble(3, 20, 3, 0), + HAnchor = HAnchor.ParentLeftRight + }; + + string make = ActiveSliceSettings.Instance.GetValue(SettingsKey.make); + string model = ActiveSliceSettings.Instance.GetValue(SettingsKey.model); + + string title = $"{make} {model}"; + if (title == "Other Other") + { + title = "Custom Profile".Localize(); } + + row.AddChild(new TextWidget(title, pointSize: 9) + { + Margin = new BorderDouble(0, 4, 10, 4), + TextColor = ActiveTheme.Instance.PrimaryTextColor, + }); + + row.AddChild(new HorizontalSpacer()); + + row.AddChild(new TextWidget(lastUpdateTime, pointSize: 9) + { + Margin = new BorderDouble(0, 4, 10, 4), + TextColor = ActiveTheme.Instance.PrimaryTextColor, + }); + + dataArea.AddChild(row); } - lastUpdateTime = "Default settings updated: {0} ".Localize().FormatWith(lastUpdateTime); - - dataArea.AddChild(new TextWidget(lastUpdateTime, textColor: ActiveTheme.Instance.SecondaryTextColor) - { - HAnchor= HAnchor.ParentCenter, - Margin = new BorderDouble(0, 15), - }); - // DELETE_PRINTER: { // This is a place holder type to allow us to put in the control that will allow the deletion of a printer profile From 3d562081a5cadee4ea002c995deadf4b9a60b247 Mon Sep 17 00:00:00 2001 From: John Lewin Date: Wed, 1 Mar 2017 10:51:26 -0800 Subject: [PATCH 2/2] Add note about missing tabs --- SlicerConfiguration/SliceSettingsWidget.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 0b15402da..a021b1d49 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -401,6 +401,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration foreach (SliceSettingData settingData in subGroup.SettingDataList) { + // Note: tab sections may disappear if they when they are empty, as controlled by: + // settingShouldBeShown / addedSettingToSubGroup / needToAddSubGroup bool settingShouldBeShown = CheckIfShouldBeShown(settingData); if (ActiveSliceSettings.Instance.Helpers.ActiveSliceEngine().MapContains(settingData.SlicerConfigName)