Skip to content

[DYN-3657] Save changes label #11671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 65 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1319780
Merge pull request #1 from DynamoDS/master
Astul-Betizagasti Jul 6, 2020
c78dfe9
Removal of unused code
Astul-Betizagasti Jul 7, 2020
e446a29
Merge pull request #2 from DynamoDS/master
Astul-Betizagasti Jul 7, 2020
a361a67
Merge branch 'master' into Graph-Workspaces-Coverage
Astul-Betizagasti Jul 7, 2020
f4d5c44
Revert "Removal of unused code"
Astul-Betizagasti Jul 7, 2020
1b91432
Added Obsolete Tag
Astul-Betizagasti Jul 7, 2020
4944efb
Message change
Astul-Betizagasti Jul 7, 2020
edf927d
Tests1
Astul-Betizagasti Jul 9, 2020
efee990
Merge pull request #3 from DynamoDS/master
Astul-Betizagasti Jul 9, 2020
948b39f
Merge pull request #4 from Astul-Betizagasti/master
Astul-Betizagasti Jul 9, 2020
ea4dce4
Merge pull request #5 from DynamoDS/master
Astul-Betizagasti Jul 10, 2020
a8b38cc
Tests changes
Astul-Betizagasti Jul 10, 2020
ec787fa
Merge pull request #7 from DynamoDS/master
Astul-Betizagasti Jul 10, 2020
7f1c3a5
WorkspaceModel Tests
Astul-Betizagasti Jul 17, 2020
a0461d6
Merge pull request #9 from DynamoDS/master
Astul-Betizagasti Jul 17, 2020
d2ebf09
Merge branch 'Graph-Workspaces-Coverage' into master
Astul-Betizagasti Jul 17, 2020
d96a729
Merge branch 'pr/11'
Astul-Betizagasti Jul 27, 2020
b0f8162
Fix merge issue
Astul-Betizagasti Jul 27, 2020
714fe11
Merge pull request #17 from DynamoDS/master
Astul-Betizagasti Aug 28, 2020
3a126b5
Merge pull request #22 from DynamoDS/master
Astul-Betizagasti Oct 5, 2020
02eda71
Merge pull request #23 from DynamoDS/master
Astul-Betizagasti Oct 15, 2020
391876c
Merge pull request #25 from DynamoDS/master
Astul-Betizagasti Oct 29, 2020
a5efddc
Merge pull request #26 from DynamoDS/master
Astul-Betizagasti Nov 20, 2020
074953f
GitHub Action For Issue Content
Astul-Betizagasti Nov 20, 2020
de03f79
Refactor
Astul-Betizagasti Nov 20, 2020
b6e27c2
Update checkIssueInfo.yaml
Astul-Betizagasti Nov 23, 2020
fb440d5
Merge pull request #27 from DynamoDS/master
Astul-Betizagasti Nov 26, 2020
053995d
Add github action
Astul-Betizagasti Nov 26, 2020
052efea
Template/Issue parser and comparator improvements
Astul-Betizagasti Nov 26, 2020
8b71a46
Merge pull request #28 from DynamoDS/master
Astul-Betizagasti Dec 4, 2020
b58c205
Merge pull request #29 from DynamoDS/master
Astul-Betizagasti Dec 8, 2020
631462e
Update infromation analyzer
Astul-Betizagasti Dec 8, 2020
90b5e82
Merge branch 'CheckIssueContent' into master
Astul-Betizagasti Dec 8, 2020
ff0d9c9
Merge pull request #31 from DynamoDS/master
Astul-Betizagasti Dec 11, 2020
ae28659
Delete checkIssueInfo.yaml
Astul-Betizagasti Jan 7, 2021
66233a8
Merge pull request #33 from DynamoDS/master
Astul-Betizagasti Jan 7, 2021
c1e51ec
Merge pull request #35 from DynamoDS/master
Astul-Betizagasti Jan 12, 2021
3f5e4a6
Merge pull request #36 from DynamoDS/master
Astul-Betizagasti Jan 20, 2021
21457f9
Merge pull request #37 from DynamoDS/master
Astul-Betizagasti Jan 21, 2021
3588f40
Merge pull request #38 from DynamoDS/master
Astul-Betizagasti Jan 25, 2021
d6a4d8b
Merge pull request #40 from DynamoDS/master
Astul-Betizagasti Jan 29, 2021
2daeaa7
Merge pull request #42 from DynamoDS/master
Astul-Betizagasti Feb 3, 2021
cbced46
Merge pull request #44 from DynamoDS/master
Astul-Betizagasti Feb 5, 2021
81233d5
Merge pull request #46 from DynamoDS/master
Astul-Betizagasti Feb 17, 2021
d65f6ef
Merge pull request #47 from DynamoDS/master
Astul-Betizagasti Feb 25, 2021
83f39a8
ux changes
Astul-Betizagasti Mar 2, 2021
045adb8
Disable preferences in debug mode
Astul-Betizagasti Mar 2, 2021
d735ddf
fix
Astul-Betizagasti Mar 3, 2021
7f0c885
visibility change
Astul-Betizagasti Mar 3, 2021
db8aa60
UX fixes
Astul-Betizagasti Mar 4, 2021
9f0292a
Merge pull request #50 from DynamoDS/master
Astul-Betizagasti Mar 4, 2021
bbe512b
Merge branch 'master' into menu-ux-update
Astul-Betizagasti Mar 4, 2021
d86e2f3
Merge pull request #51 from Astul-Betizagasti/menu-ux-update
Astul-Betizagasti Mar 4, 2021
195eb7f
Update DynamoView.xaml
Astul-Betizagasti Mar 12, 2021
b7a405e
Merge pull request #52 from DynamoDS/master
Astul-Betizagasti Mar 12, 2021
45a7285
Merge pull request #53 from DynamoDS/master
Astul-Betizagasti Mar 15, 2021
7c384f8
Merge pull request #54 from DynamoDS/master
Astul-Betizagasti Mar 18, 2021
bf6226b
Merge branch 'master' of https://github.com/DynamoDS/Dynamo
Astul-Betizagasti Mar 23, 2021
1add301
Merge branch 'master' of https://github.com/DynamoDS/Dynamo
Astul-Betizagasti Mar 29, 2021
5a96392
Merge branch 'master' of https://github.com/DynamoDS/Dynamo
Astul-Betizagasti Apr 12, 2021
1dd370f
Merge branch 'master' of https://github.com/DynamoDS/Dynamo
Astul-Betizagasti Apr 16, 2021
d136cd0
Merge branch 'master' of https://github.com/DynamoDS/Dynamo
Astul-Betizagasti Apr 22, 2021
d9cca05
Merge branch 'master' of https://github.com/DynamoDS/Dynamo
Astul-Betizagasti May 4, 2021
19be817
Merge branch 'master' of https://github.com/DynamoDS/Dynamo
Astul-Betizagasti May 7, 2021
9fc169c
Change save button into a label that will show when changes where saved
Astul-Betizagasti May 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2382,4 +2382,10 @@ Uninstall the following packages: {0}?</value>
<value>Italicized locations are disabled.</value>
<comment>Italic locations are disabled. This can currently only be the standard library.</comment>
</data>
<data name="PreferencesViewSavedChangesLabel" xml:space="preserve">
<value>All changes saved automatically</value>
</data>
<data name="PreferencesViewSavedChangesTooltip" xml:space="preserve">
<value>Last saved: </value>
</data>
</root>
6 changes: 6 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2382,4 +2382,10 @@ Uninstall the following packages: {0}?</value>
<value>Italicized locations are disabled.</value>
<comment>Italic locations are disabled. This can currently only be the standard library.</comment>
</data>
<data name="PreferencesViewSavedChangesLabel" xml:space="preserve">
<value>All changes saved automatically</value>
</data>
<data name="PreferencesViewSavedChangesTooltip" xml:space="preserve">
<value>Last saved:</value>
</data>
</root>
83 changes: 72 additions & 11 deletions src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Res = Dynamo.Wpf.Properties.Resources;
Expand All @@ -25,6 +26,8 @@ public enum GeometryScaleSize
public class PreferencesViewModel : ViewModelBase
{
#region Private Properties
private string savedChangesLabel;
private string savedChangesTooltip;
private ObservableCollection<string> languagesList;
private ObservableCollection<string> fontSizeList;
private ObservableCollection<string> numberFormatList;
Expand Down Expand Up @@ -72,6 +75,38 @@ public Tuple<string, string, string> ScaleRange
{GeometryScaleSize.ExtraLarge, new Tuple<string, string, string>("extra large", "1", "100,000,000")}
};

/// <summary>
/// Controls what the SavedChanges label will display
/// </summary>
public string SavedChangesLabel
{
get
{
return savedChangesLabel;
}
set
{
savedChangesLabel = value;
RaisePropertyChanged(nameof(SavedChangesLabel));
}
}

/// <summary>
/// Controls what SavedChanges label's tooltip will display
/// </summary>
public string SavedChangesTooltip
{
get
{
return savedChangesTooltip;
}
set
{
savedChangesTooltip = value;
RaisePropertyChanged(nameof(SavedChangesTooltip));

}
}
//This includes all the properties that can be set on the General tab
#region General Properties
/// <summary>
Expand All @@ -87,6 +122,7 @@ public string SelectedLanguage
{
selectedLanguage = value;
RaisePropertyChanged(nameof(SelectedLanguage));
UpdateSavedChangesLabel();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This call is repeated too many times. We can add a property change listener so we can listen to changes and call this automatically. That way we can get rid of all these single calls.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like here: https://github.com/DynamoDS/Dynamo/blob/master/src/DynamoCoreWpf/ViewModels/Core/NodeViewModel.cs#L636. Single handler can handle all property change I think, then we can filter out properties we need and call UpdateSavedChangesLabel() there

}
}

Expand All @@ -103,6 +139,7 @@ public string SelectedFontSize
{
selectedFontSize = value;
RaisePropertyChanged(nameof(SelectedFontSize));
UpdateSavedChangesLabel();
}
}

Expand All @@ -120,6 +157,7 @@ public string SelectedNumberFormat
selectedNumberFormat = value;
preferenceSettings.NumberFormat = value;
RaisePropertyChanged(nameof(SelectedNumberFormat));
UpdateSavedChangesLabel();
}
}

Expand All @@ -145,17 +183,7 @@ public bool RunSettingsIsChecked
runSettingsIsChecked = RunType.Automatic;
}
RaisePropertyChanged(nameof(RunSettingsIsChecked));
}
}

/// <summary>
/// Controls the IsChecked property in the Show Run Preview toogle button
/// </summary>
public bool RunPreviewEnabled
{
get
{
return runPreviewEnabled;
UpdateSavedChangesLabel();
}
}

Expand All @@ -172,6 +200,7 @@ public bool RunPreviewIsChecked
{
dynamoViewModel.ShowRunPreview = value;
RaisePropertyChanged(nameof(RunPreviewIsChecked));
UpdateSavedChangesLabel();
}
}

Expand Down Expand Up @@ -224,6 +253,7 @@ public ObservableCollection<string> NumberFormatList
}
#endregion

//This includes all the properties that can be set on the Visual Settings tab
#region VisualSettings Properties
/// <summary>
/// This will contain a list of all the Styles created by the user in the Styles list ( Visual Settings -> Group Styles section)
Expand All @@ -238,6 +268,17 @@ public ObservableCollection<StyleItem> StyleItemsList
}
}

/// <summary>
/// Used to add styles to the StyleItemsListe while also update the saved changes label
/// </summary>
/// <param name="style"></param>
public void AddStyle(StyleItem style)
{
StyleItemsList.Add(style);
RaisePropertyChanged(nameof(StyleItemsList));
UpdateSavedChangesLabel();
}

/// <summary>
/// This flag will be in true when the Style that user is trying to add already exists (otherwise will be false - Default)
/// </summary>
Expand Down Expand Up @@ -284,6 +325,7 @@ public GeometryScalingOptions OptionsGeometryScal
{
optionsGeometryScal = value;
RaisePropertyChanged(nameof(OptionsGeometryScal));
UpdateSavedChangesLabel();
}
}

Expand All @@ -300,6 +342,7 @@ public bool ShowEdges
{
showEdges = value;
RaisePropertyChanged(nameof(ShowEdges));
UpdateSavedChangesLabel();
}
}

Expand All @@ -316,6 +359,7 @@ public bool IsolateSelectedGeometry
{
isolateSelectedGeometry = value;
RaisePropertyChanged(nameof(IsolateSelectedGeometry));
UpdateSavedChangesLabel();
}
}

Expand All @@ -332,6 +376,7 @@ public int TessellationDivisions
{
dynamoViewModel.RenderPackageFactoryViewModel.MaxTessellationDivisions = value;
RaisePropertyChanged(nameof(TessellationDivisions));
UpdateSavedChangesLabel();
}
}
#endregion
Expand Down Expand Up @@ -370,6 +415,7 @@ public string SelectedPythonEngine
selectedPythonEngine = value;
preferenceSettings.DefaultPythonEngine = value;
RaisePropertyChanged(nameof(SelectedPythonEngine));
UpdateSavedChangesLabel();
}
}
}
Expand All @@ -388,6 +434,7 @@ public bool HideIronPythonAlertsIsChecked
hideIronPAlerts = value;
preferenceSettings.IsIronPythonDialogDisabled = value;
RaisePropertyChanged(nameof(HideIronPythonAlertsIsChecked));
UpdateSavedChangesLabel();
}
}

Expand All @@ -406,6 +453,7 @@ public bool ShowWhitespaceIsChecked
preferenceSettings.ShowTabsAndSpacesInScriptEditor = value;
showWhitespace = value;
RaisePropertyChanged(nameof(ShowWhitespaceIsChecked));
UpdateSavedChangesLabel();
}
}

Expand All @@ -423,6 +471,7 @@ public bool NodeAutocompleteIsChecked
preferenceSettings.EnableNodeAutoComplete = value;
nodeAutocomplete = value;
RaisePropertyChanged(nameof(NodeAutocompleteIsChecked));
UpdateSavedChangesLabel();
}
}

Expand All @@ -441,6 +490,7 @@ public bool EnableTSplineIsChecked
enableTSpline = value;
HideUnhideNamespace(!value, "ProtoGeometry.dll", "Autodesk.DesignScript.Geometry.TSpline");
RaisePropertyChanged(nameof(EnableTSplineIsChecked));
UpdateSavedChangesLabel();
}
}

Expand Down Expand Up @@ -580,6 +630,16 @@ public PreferencesViewModel(DynamoViewModel dynamoViewModel)
scaleRanges[GeometryScaleSize.Large].Item3));
optionsGeometryScal.DescriptionScaleRange.Add(string.Format(Res.ChangeScaleFactorPromptDescriptionContent, scaleRanges[GeometryScaleSize.ExtraLarge].Item2,
scaleRanges[GeometryScaleSize.ExtraLarge].Item3));

SavedChangesLabel = string.Empty;
SavedChangesTooltip = string.Empty;
}

internal void UpdateSavedChangesLabel()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add some comments to this function

{
SavedChangesLabel = Res.PreferencesViewSavedChangesLabel;
//Sets the last saved time in the en-US format
SavedChangesTooltip = Res.PreferencesViewSavedChangesTooltip + DateTime.Now.ToString(@"hh:mm tt", new CultureInfo("en-US"));
}

/// <summary>
Expand All @@ -590,6 +650,7 @@ internal void RemoveStyleEntry(string groupName)
{
StyleItem itemToRemove = (from item in StyleItemsList where item.GroupName.Equals(groupName) select item).FirstOrDefault();
StyleItemsList.Remove(itemToRemove);
UpdateSavedChangesLabel();
}

/// <summary>
Expand Down
20 changes: 9 additions & 11 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@
<!--This Grid row contains the Python section-->
<Grid Grid.Row="0">
<Expander x:Name="PythonExpander"
IsExpanded="True"
Style="{StaticResource MenuExpanderStyle}"
Header="{x:Static p:Resources.PreferencesViewPython}">
<StackPanel Orientation="Vertical" Margin="0,6,0,0">
Expand Down Expand Up @@ -659,18 +660,15 @@
Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="50"></RowDefinition>
</Grid.RowDefinitions>
<Button Name="SaveChanges"
Grid.Row="2"
Style="{StaticResource NormalButtonStyle}"
HorizontalAlignment="Right"
Margin="0,0,14,0"
Width="112"
Height="36"
Click="SaveChanges_Click">
Save Changes
</Button>
<Label Name="SavedChanges"
Grid.Row="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground ="{StaticResource PreferencesWindowFontColor}"
Margin="0,0,14,0"
Content="{Binding SavedChangesLabel, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
ToolTip="{Binding SavedChangesTooltip, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</Grid>
</Window>
8 changes: 2 additions & 6 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ private void InitRadioButtonsDescription()
RadioExtraLargeDesc.Inlines.Add(viewModel.OptionsGeometryScal.DescriptionScaleRange[2]);
}

private void SaveChanges_Click(object sender, RoutedEventArgs e)
{

}

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close();
Expand Down Expand Up @@ -98,7 +93,7 @@ private void AddStyle_SaveButton_Click(object sender, RoutedEventArgs e)
//if the validation returns false it means that the new style that will be added doesn't exists
if (viewModel.ValidateExistingStyle(newItem) == false)
{
viewModel.StyleItemsList.Add(newItem);
viewModel.AddStyle(newItem);
viewModel.ResetAddStyleControl();
AddStyleBorder.Visibility = Visibility.Collapsed;
AddStyleButton.IsEnabled = true;
Expand Down Expand Up @@ -199,6 +194,7 @@ private void Geometry_Scaling_Checked(object sender, RoutedEventArgs e)

var allNodes = dynViewModel.HomeSpace.Nodes;
dynViewModel.HomeSpace.MarkNodesAsModifiedAndRequestRun(allNodes, forceExecute: true);
viewModel.UpdateSavedChangesLabel();
}
}

Expand Down