Skip to content

Commit 5ad1028

Browse files
authored
DYN-8850: Reconfigure preference settings for node autocomplete (#16230)
1 parent 3b91079 commit 5ad1028

File tree

11 files changed

+210
-155
lines changed

11 files changed

+210
-155
lines changed

src/DynamoCore/Configuration/PreferenceSettings.cs

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,22 @@ public string PythonTemplateFilePath
682682
/// </summary>
683683
public int MLRecommendationConfidenceLevel { get; set; }
684684

685+
private int mLRecommendationNumberOfResults;
685686
/// <summary>
686687
/// This defines the number of results of the ML recommendation
687688
/// </summary>
688-
public int MLRecommendationNumberOfResults { get; set; }
689+
public int MLRecommendationNumberOfResults
690+
{
691+
get => mLRecommendationNumberOfResults;
692+
set
693+
{
694+
if (mLRecommendationNumberOfResults != value)
695+
{
696+
mLRecommendationNumberOfResults = value;
697+
AutocompletePreferencesChanged?.Invoke();
698+
}
699+
}
700+
}
689701

690702
/// <summary>
691703
/// If true, autocomplete method options are hidden from UI
@@ -853,10 +865,27 @@ public bool DisableCustomPackageLocations
853865
/// </summary>
854866
public RunType DefaultRunType { get; set; }
855867

868+
private NodeAutocompleteSuggestion defaultNodeAutocompleteSuggestion;
856869
/// <summary>
857870
/// Defines the default method of the Node Autocomplete
858871
/// </summary>
859-
public NodeAutocompleteSuggestion DefaultNodeAutocompleteSuggestion { get; set; }
872+
public NodeAutocompleteSuggestion DefaultNodeAutocompleteSuggestion
873+
{
874+
get => defaultNodeAutocompleteSuggestion;
875+
set
876+
{
877+
if(defaultNodeAutocompleteSuggestion != value)
878+
{
879+
defaultNodeAutocompleteSuggestion = value;
880+
AutocompletePreferencesChanged?.Invoke();
881+
}
882+
}
883+
}
884+
885+
/// <summary>
886+
/// Event that is fired when autocomplete-specific preferences are changed
887+
/// </summary>
888+
internal event Action AutocompletePreferencesChanged;
860889

861890
/// <summary>
862891
/// Show Run Preview flag.

src/DynamoCoreWpf/Properties/Resources.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/DynamoCoreWpf/Properties/Resources.en-US.resx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3573,7 +3573,7 @@ You can manage this in Preferences -&gt; Security.</value>
35733573
<value>Confidence level appears next to each recommended node and represents estimated probability that the node is a good choice. When toggled on, this setting hides recommended nodes that don’t meet the specified confidence level. You can click the Low Confidence header to show the nodes.</value>
35743574
</data>
35753575
<data name="MLRecommendationNumberOfResults" xml:space="preserve">
3576-
<value>Number of results</value>
3576+
<value>Number of results for Recommended Nodes</value>
35773577
</data>
35783578
<data name="ImportPreferencesText" xml:space="preserve">
35793579
<value>Import</value>
@@ -4155,4 +4155,4 @@ To make this file into a new template, save it to a different folder, then move
41554155
<data name="GroupFrozenButtonToolTip" xml:space="preserve">
41564156
<value>This group is frozen. Click to unfreeze.</value>
41574157
</data>
4158-
</root>
4158+
</root>

src/DynamoCoreWpf/Properties/Resources.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3560,7 +3560,7 @@ You can manage this in Preferences -&gt; Security.</value>
35603560
<value>Confidence level appears next to each recommended node and represents estimated probability that the node is a good choice. When toggled on, this setting hides recommended nodes that don’t meet the specified confidence level. You can click the Low Confidence header to show the nodes.</value>
35613561
</data>
35623562
<data name="MLRecommendationNumberOfResults" xml:space="preserve">
3563-
<value>Number of results</value>
3563+
<value>Number of results for Recommended Nodes</value>
35643564
</data>
35653565
<data name="ImportPreferencesText" xml:space="preserve">
35663566
<value>Import</value>

src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml

Lines changed: 43 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -941,34 +941,66 @@
941941
</Label>
942942
</StackPanel>
943943

944-
<StackPanel Orientation="Horizontal" Margin="0,-5,0,0" Grid.Row="1"
944+
<StackPanel Orientation="Horizontal" Margin="0,0,0,0" Grid.Row="1"
945945
Visibility="{Binding HideAutocompleteMethodOptions, Converter={StaticResource InverseBoolToVisibilityCollapsedConverter}}">
946946
<!-- This Grid contains controls for selecting the Node autocomplete method -->
947-
<Grid Margin="60,0,0,0">
947+
<Grid Margin="0,0,0,0">
948948
<Grid.RowDefinitions>
949949
<RowDefinition Height="Auto" />
950950
<RowDefinition Height="*" />
951951
<RowDefinition Height="*" />
952+
<RowDefinition Height="*" />
952953
</Grid.RowDefinitions>
953-
<Label Grid.Row="0"
954-
Margin="-8,15,10,3"
954+
<Grid Grid.Row="0">
955+
<Grid.RowDefinitions>
956+
<RowDefinition Height="*" />
957+
<RowDefinition Height="*" />
958+
<RowDefinition Height="*" />
959+
<RowDefinition Height="*" />
960+
</Grid.RowDefinitions>
961+
<StackPanel Margin="-5,5,0,0" Orientation="Horizontal" Grid.Row="0">
962+
<Label Content="{x:Static p:Resources.MLRecommendationNumberOfResults}"
963+
VerticalAlignment="Center"
964+
Foreground="{StaticResource PreferencesWindowFontColor}"
965+
FontWeight="Normal"/>
966+
<TextBox Name="MLRecommendationResultsNumber"
967+
HorizontalAlignment="Left"
968+
Margin="2,0,0,0"
969+
MinWidth="25"
970+
Height="20"
971+
FontWeight="Regular"
972+
Text="{Binding MLRecommendationNumberOfResults}"
973+
Background="{StaticResource PreferencesWindowBackgroundColor}"
974+
Foreground="{StaticResource PreferencesWindowFontColor}"
975+
BorderThickness="0,0,0,2"
976+
PreviewTextInput="NumberValidationTextBox"
977+
IsEnabled="{Binding Path=NodeAutocompleteMachineLearningIsChecked}"/>
978+
</StackPanel>
979+
</Grid>
980+
<Label Grid.Row="1"
981+
Margin="-5,5,0,0"
955982
Content="{x:Static p:Resources.PreferencesNodeAutocompleteMethod}"
956983
Foreground="{StaticResource PreferencesWindowFontColor}"/>
957-
<Grid Grid.Row="1" >
984+
<Grid Grid.Row="2"
985+
Margin="0,5,0,5">
958986
<Grid.ColumnDefinitions>
959987
<ColumnDefinition x:Name="colObjectType" Width="Auto"/>
960-
<ColumnDefinition x:Name="colMachineLearning" Width="Auto"/>
961-
<ColumnDefinition x:Name="colMLbetaTag" Width="Auto"/>
962988
</Grid.ColumnDefinitions>
963-
<RadioButton Grid.Column="0"
989+
<RadioButton Grid.Column="0"
964990
x:Name="ObjectTypeRadioButton"
965991
MinWidth="90"
966-
Margin="-3,0,20,0"
967992
Style="{StaticResource RunSettingsRadioButtons}"
968993
IsChecked="{Binding Path=NodeAutocompleteMachineLearningIsChecked, Converter={StaticResource BinaryRadioButtonCheckedConverter},ConverterParameter=False}"
969994
Content="{x:Static p:Resources.ObjectType}"
970995
IsEnabled="{Binding Path=NodeAutocompleteIsChecked}"/>
971-
<RadioButton Grid.Column="1"
996+
</Grid>
997+
<Grid Grid.Row="3"
998+
Margin="0,5,0,5">
999+
<Grid.ColumnDefinitions>
1000+
<ColumnDefinition x:Name="colMachineLearning" Width="Auto"/>
1001+
<ColumnDefinition x:Name="colMLbetaTag" Width="Auto"/>
1002+
</Grid.ColumnDefinitions>
1003+
<RadioButton Grid.Column="0"
9721004
x:Name="RecommendedNodesRadioButton"
9731005
MinWidth="90"
9741006
Style="{StaticResource RunSettingsRadioButtons}"
@@ -977,7 +1009,7 @@
9771009
Click="RecommendedNodesRadioButton_Click"
9781010
IsEnabled="{Binding Path=NodeAutocompleteIsChecked}"/>
9791011
<!--Beta tag-->
980-
<Label Grid.Column="2"
1012+
<Label Grid.Column="1"
9811013
Name="NodeRecommendationBetaTag"
9821014
Content="{x:Static p:Resources.PreferencesViewBetaTag}"
9831015
Background="{StaticResource SecondaryGray}"
@@ -993,87 +1025,6 @@
9931025
</Label.Resources>
9941026
</Label>
9951027
</Grid>
996-
<Grid Grid.Row="2">
997-
<Grid.RowDefinitions>
998-
<RowDefinition Height="*" />
999-
<RowDefinition Height="*" />
1000-
<RowDefinition Height="*" />
1001-
<RowDefinition Height="*" />
1002-
</Grid.RowDefinitions>
1003-
<StackPanel Margin="-10,5,0,0" Orientation="Horizontal" Grid.Row="0">
1004-
<Label Content="{x:Static p:Resources.MLRecommendationNumberOfResults}"
1005-
VerticalAlignment="Center"
1006-
Foreground="{StaticResource PreferencesWindowFontColor}"
1007-
FontWeight="Normal"/>
1008-
<TextBox Name="MLRecommendationResultsNumber"
1009-
HorizontalAlignment="Left"
1010-
Margin="2,0,0,0"
1011-
MinWidth="25"
1012-
Height="20"
1013-
FontWeight="Regular"
1014-
Text="{Binding MLRecommendationNumberOfResults}"
1015-
Background="{StaticResource PreferencesWindowBackgroundColor}"
1016-
Foreground="{StaticResource PreferencesWindowFontColor}"
1017-
BorderThickness="0,0,0,2"
1018-
PreviewTextInput="NumberValidationTextBox"
1019-
IsEnabled="{Binding Path=NodeAutocompleteMachineLearningIsChecked}"/>
1020-
</StackPanel>
1021-
<StackPanel Margin="-60,10,0,0" Orientation="Horizontal" Grid.Row="1">
1022-
<ToggleButton Name="MLRecommendationConfidenceThresholdToogle"
1023-
Width="{StaticResource ToggleButtonWidth}"
1024-
Height="{StaticResource ToggleButtonHeight}"
1025-
VerticalAlignment="Center"
1026-
IsChecked="{Binding Path=HideNodesBelowSpecificConfidenceLevelIsChecked}"
1027-
Style="{StaticResource EllipseToggleButton1}"
1028-
IsEnabled="{Binding Path=EnableHideNodesToggle}"/>
1029-
<Label Content="{x:Static p:Resources.PreferredConfidenceLevel}"
1030-
Margin="10,0,0,0"
1031-
VerticalAlignment="Center"
1032-
Foreground="{StaticResource PreferencesWindowFontColor}"
1033-
FontWeight="Regular"/>
1034-
<Image Name="MLRecommendationConfidenceThresholdToolTip"
1035-
Margin="5,3,0,0"
1036-
Width="14"
1037-
Height="14"
1038-
HorizontalAlignment="Center"
1039-
VerticalAlignment="Center"
1040-
Style="{StaticResource QuestionIcon}"
1041-
ToolTipService.ShowDuration="30000">
1042-
<Image.ToolTip>
1043-
<ToolTip Content="{x:Static p:Resources.PreferredConfidenceLevelInfo}" Style="{StaticResource GenericToolTipLight}"/>
1044-
</Image.ToolTip>
1045-
</Image>
1046-
</StackPanel>
1047-
<StackPanel Margin="-10,5,0,0" Orientation="Horizontal" Grid.Row="2">
1048-
<Label Content="{x:Static p:Resources.PreferencesViewZoomScaling0Percent}"
1049-
Name="lblConfidenceLevelLabelStart"
1050-
VerticalAlignment="Center"
1051-
Foreground="{StaticResource PreferencesWindowFontColor}"
1052-
FontWeight="Regular"/>
1053-
<Slider Width="300"
1054-
Minimum="0"
1055-
Maximum="100"
1056-
Value="{Binding Path=MLRecommendationConfidenceLevel, Mode=TwoWay}"
1057-
IsEnabled="{Binding Path=EnableConfidenceLevelSlider}"
1058-
ValueChanged="sliderConfidenceLevel_ValueChanged">
1059-
</Slider>
1060-
<Label Content="{x:Static p:Resources.PreferencesViewZoomScaling100Percent}"
1061-
Margin="0,-5,0,0"
1062-
VerticalAlignment="Center"
1063-
Foreground="{StaticResource PreferencesWindowFontColor}"
1064-
FontWeight="Regular"/>
1065-
</StackPanel>
1066-
<StackPanel Margin="-10,5,0,0" Orientation="Horizontal" Grid.Row="3">
1067-
<Label
1068-
Name="lblConfidenceLevel"
1069-
Width="30"
1070-
VerticalAlignment="Center"
1071-
HorizontalContentAlignment="Center"
1072-
Foreground="{StaticResource PreferencesWindowFontColor}"
1073-
FontWeight="Regular"
1074-
Content="{Binding Path=MLRecommendationConfidenceLevel, Mode=TwoWay}"/>
1075-
</StackPanel>
1076-
</Grid>
10771028
</Grid>
10781029
</StackPanel>
10791030
</Grid>

0 commit comments

Comments
 (0)