From 146b6ea8d81ea6fb0812939693dd22492fd73852 Mon Sep 17 00:00:00 2001 From: Ashish Aggarwal Date: Mon, 10 Apr 2023 13:08:30 -0400 Subject: [PATCH] Multiple fixes for 2.18 (#13880) * DYN-4930 - Update Defaults * DYN-5718 Localize tooltip * DYN-5751 ML recs score formatting * DYN-5655 - Fix documentation link --- .../Properties/Resources.Designer.cs | 6 ++-- .../Properties/Resources.en-US.resx | 6 ++-- src/DynamoCore/Properties/Resources.resx | 6 ++-- .../NodeAutoCompleteSearchControl.xaml.cs | 5 ++- .../Controls/ShortcutToolbar.xaml | 2 +- .../Properties/Resources.Designer.cs | 4 +-- .../Properties/Resources.en-US.resx | 30 ++++++++--------- src/DynamoCoreWpf/Properties/Resources.resx | 32 +++++++++---------- src/DynamoCoreWpf/UI/Converters.cs | 23 +++++++++++++ .../UI/Themes/Modern/DynamoConverters.xaml | 1 + .../Modern/SidebarGridStyleDictionary.xaml | 5 +-- src/DynamoCoreWpf/Views/Core/NodeView.xaml | 14 ++++---- .../Views/Menu/PreferencesView.xaml | 29 +++++++++-------- .../Views/Menu/PreferencesView.xaml.cs | 11 ++----- 14 files changed, 99 insertions(+), 75 deletions(-) diff --git a/src/DynamoCore/Properties/Resources.Designer.cs b/src/DynamoCore/Properties/Resources.Designer.cs index 6b2aa2c07dd..c901902b459 100644 --- a/src/DynamoCore/Properties/Resources.Designer.cs +++ b/src/DynamoCore/Properties/Resources.Designer.cs @@ -1,4 +1,4 @@ -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:4.0.30319.42000 @@ -795,7 +795,7 @@ public static string GoodByeLog { } /// - /// Looks up a localized string similar to <Double click here to edit group description>. + /// Looks up a localized string similar to Description <Double click here to edit group description>. /// public static string GroupDefaultText { get { @@ -804,7 +804,7 @@ public static string GroupDefaultText { } /// - /// Looks up a localized string similar to <Double click here to edit group title>. + /// Looks up a localized string similar to Title <Double click here to edit group title>. /// public static string GroupNameDefaultText { get { diff --git a/src/DynamoCore/Properties/Resources.en-US.resx b/src/DynamoCore/Properties/Resources.en-US.resx index 7c5d2c959c7..dbc18de0f7c 100644 --- a/src/DynamoCore/Properties/Resources.en-US.resx +++ b/src/DynamoCore/Properties/Resources.en-US.resx @@ -781,10 +781,10 @@ This package is loaded and ready to be used. This package has not been loaded because another conflicting package was loaded before it. - <Double click here to edit group description> + Description <Double click here to edit group description> - <Double click here to edit group title> + Title <Double click here to edit group title> output @@ -902,4 +902,4 @@ This package likely contains an assembly that is blocked. You will need to load English,Čeština,Deutsch,Español,Français,Italiano,日本語,한국어,Polski,Português (Brasil),Русский,简体中文,繁體中文 - + \ No newline at end of file diff --git a/src/DynamoCore/Properties/Resources.resx b/src/DynamoCore/Properties/Resources.resx index caff4dad35f..eae3ecfdf31 100644 --- a/src/DynamoCore/Properties/Resources.resx +++ b/src/DynamoCore/Properties/Resources.resx @@ -786,10 +786,10 @@ This package is loaded and ready to be used. This package has not been loaded because another conflicting package was loaded before it. - <Double click here to edit group description> + Description <Double click here to edit group description> - <Double click here to edit group title> + Title <Double click here to edit group title> Show all errors @@ -905,4 +905,4 @@ This package likely contains an assembly that is blocked. You will need to load English,Čeština,Deutsch,Español,Français,Italiano,日本語,한국어,Polski,Português (Brasil),Русский,简体中文,繁體中文 - + \ No newline at end of file diff --git a/src/DynamoCoreWpf/Controls/NodeAutoCompleteSearchControl.xaml.cs b/src/DynamoCoreWpf/Controls/NodeAutoCompleteSearchControl.xaml.cs index 56d7719319a..4168958d142 100644 --- a/src/DynamoCoreWpf/Controls/NodeAutoCompleteSearchControl.xaml.cs +++ b/src/DynamoCoreWpf/Controls/NodeAutoCompleteSearchControl.xaml.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Windows; using System.Windows.Controls; @@ -160,7 +161,9 @@ private void OnMouseEnter(object sender, MouseEventArgs e) DisplayOrHideConfidenceTooltip(sender); dynamic currentNodeSearchElement = currentListBoxItem.DataContext; - confidenceScoreTitle.Text = $"{Res.ConfidenceToolTipTitle}: {currentNodeSearchElement.AutoCompletionNodeMachineLearningInfo.ConfidenceScore}%"; + var scoreFormatter = new Dynamo.Controls.ConfidenceScoreFormattingConverter(); + var score = scoreFormatter.Convert(currentNodeSearchElement.AutoCompletionNodeMachineLearningInfo.ConfidenceScore, null, null, CultureInfo.CurrentCulture); + confidenceScoreTitle.Text = $"{Res.ConfidenceToolTipTitle}: {score}%"; } private void onCloseConfidenceToolTip(object sender, RoutedEventArgs e) diff --git a/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml b/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml index 4b8675eedf6..3c33e94095b 100644 --- a/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml +++ b/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml @@ -217,7 +217,7 @@ Command="{Binding SignOutCommand}" Name="logoutOption"> - + diff --git a/src/DynamoCoreWpf/Properties/Resources.Designer.cs b/src/DynamoCoreWpf/Properties/Resources.Designer.cs index bf6bd9e96a4..50362d9c6cd 100644 --- a/src/DynamoCoreWpf/Properties/Resources.Designer.cs +++ b/src/DynamoCoreWpf/Properties/Resources.Designer.cs @@ -3419,7 +3419,7 @@ public static string GroupContextMenuUngroup { } /// - /// Looks up a localized string similar to <Double click here to edit group description>. + /// Looks up a localized string similar to Description <Double click here to edit group description>. /// public static string GroupDefaultText { get { @@ -3428,7 +3428,7 @@ public static string GroupDefaultText { } /// - /// Looks up a localized string similar to <Double click here to edit group title>. + /// Looks up a localized string similar to Title <Double click here to edit group title>. /// public static string GroupNameDefaultText { get { diff --git a/src/DynamoCoreWpf/Properties/Resources.en-US.resx b/src/DynamoCoreWpf/Properties/Resources.en-US.resx index 4acb0b453ad..82d75239203 100644 --- a/src/DynamoCoreWpf/Properties/Resources.en-US.resx +++ b/src/DynamoCoreWpf/Properties/Resources.en-US.resx @@ -2560,10 +2560,10 @@ Do you wish to uninstall {1}? Restart {2} to complete the uninstall and try down Finished - <Double click here to edit group description> + Description <Double click here to edit group description> - <Click here to edit the group title> + Title <Click here to edit the group title> Add Group to This Group @@ -3537,28 +3537,28 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in Library - Input Port Properties - Input Port title + Input Port Properties + Input Port title - Output Port Properties - Output Port title + Output Port Properties + Output Port title - Description of port - Description of port + Description of port + Description of port - Description - Port Description Label + Description + Port Description Label - Port name - Name of port + Port name + Name of port - - Name - Port Name Label + + Name + Port Name Label Remove port? diff --git a/src/DynamoCoreWpf/Properties/Resources.resx b/src/DynamoCoreWpf/Properties/Resources.resx index 253be49a39a..ae13b0508a9 100644 --- a/src/DynamoCoreWpf/Properties/Resources.resx +++ b/src/DynamoCoreWpf/Properties/Resources.resx @@ -1835,7 +1835,7 @@ Do you want to install the latest Dynamo update? Run started with new working range... - <Double click here to edit group description> + Description <Double click here to edit group description> Select Background @@ -2541,11 +2541,11 @@ Uninstall the following packages: {0}? Confidence rating Confidence tooltip title - + Represents estimated probability that the given node is the right choice. Recommended nodes are listed in order from highest to lowest confidence level. Confidence level percentages for all recommended nodes add up to about 100%. Confidence tooltip description - + Learn more Confidence tooltip Learn more @@ -2805,7 +2805,7 @@ Do you wish to uninstall {1}? Restart {2} to complete the uninstall and try down Finished - <Double click here to edit group title> + Title <Double click here to edit group title> Add Group to This Group @@ -3524,28 +3524,28 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in Library - Input Port Properties - Input Port title + Input Port Properties + Input Port title - Output Port Properties - Output Port title + Output Port Properties + Output Port title - Description of port - Description of port + Description of port + Description of port - Description - Port Description Label + Description + Port Description Label - Port name - Name of port + Port name + Name of port - Name - Port Name Label + Name + Port Name Label Remove port? diff --git a/src/DynamoCoreWpf/UI/Converters.cs b/src/DynamoCoreWpf/UI/Converters.cs index a77aca173c2..a01df07af61 100644 --- a/src/DynamoCoreWpf/UI/Converters.cs +++ b/src/DynamoCoreWpf/UI/Converters.cs @@ -2595,6 +2595,29 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu } } + /// + /// This converts the ML node autocomplete confidence score to a formatted string for display. + /// + public class ConfidenceScoreFormattingConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + var text = value == null ? string.Empty : value.ToString(); + var score = value == null ? 0 : (double)value; + if (score < 1) + { + text = "<1"; + } + return text; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + var text = value.ToString(); + return text; + } + } + public class MenuItemCheckConverter : IValueConverter { /// diff --git a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoConverters.xaml b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoConverters.xaml index 5d246e75adc..968e5b84280 100644 --- a/src/DynamoCoreWpf/UI/Themes/Modern/DynamoConverters.xaml +++ b/src/DynamoCoreWpf/UI/Themes/Modern/DynamoConverters.xaml @@ -131,6 +131,7 @@ + + Text="{Binding AutoCompletionNodeMachineLearningInfo.ConfidenceScore, StringFormat= {}{0} %, Mode=OneWay, Converter={StaticResource ConfidenceScoreFormattingConverter}}" Foreground="{StaticResource DynamoStandardLabelTextBrush}"> - - - - - + + - \ No newline at end of file + diff --git a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml index d9fe57c0ad7..7965402bf2d 100644 --- a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml +++ b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml @@ -807,19 +807,20 @@ Margin="10,0,0,0" VerticalAlignment="Center" Foreground="{StaticResource PreferencesWindowFontColor}"/> - - - - - + diff --git a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs index a4429b0fb5d..caa6b69ccf4 100644 --- a/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs +++ b/src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml.cs @@ -326,13 +326,13 @@ private void Log(ILogMessage obj) /// private void OnMoreInfoClicked(object sender, RoutedEventArgs e) { - if (sender is Label lable) + if (sender is Label label) { - if (lable.Name == "Titleinfo") + if (label.Name == "MLNodeAutocompleteLabel") { dynViewModel.OpenDocumentationLinkCommand.Execute(new OpenDocumentationLinkEventArgs(new Uri(Wpf.Properties.Resources.NodeAutocompleteDocumentationUriString, UriKind.Relative))); } - else if (lable.Name == "TrustWarningInfoLabel") + else if (label.Name == "TrustWarningInfoLabel") { dynViewModel.OpenDocumentationLinkCommand.Execute(new OpenDocumentationLinkEventArgs(new Uri(Wpf.Properties.Resources.FileTrustWarningDocumentationUriString, UriKind.Relative))); @@ -448,11 +448,6 @@ private void importTextBlock_MouseLeftButtonDown(object sender, MouseButtonEvent } } - private void OnMoreInfoClicked(object sender, MouseButtonEventArgs e) - { - dynViewModel.OpenDocumentationLinkCommand.Execute(new OpenDocumentationLinkEventArgs(new Uri(Dynamo.Wpf.Properties.Resources.NodeAutocompleteDocumentationUriString, UriKind.Relative))); - } - private void exportTextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var dialog = new DynamoFolderBrowserDialog