Skip to content
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

Dyn 5288 node autocomplete improvements #13410

Merged
merged 13 commits into from
Oct 25, 2022
63 changes: 63 additions & 0 deletions src/DynamoCore/Properties/Resources.Designer.cs

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

25 changes: 23 additions & 2 deletions src/DynamoCore/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Expand Down Expand Up @@ -869,4 +869,25 @@ This package likely contains an assembly that is blocked. You will need to load
<data name="SplashScreenLoadNodeLibrary" xml:space="preserve">
<value>Loading Node Library...</value>
</data>
</root>
<data name="AutocompleteNoRecommendationsTitle" xml:space="preserve">
<value>No recommendations</value>
</data>
<data name="AutocompleteLowConfidenceTitle" xml:space="preserve">
<value>Low confidence</value>
</data>
<data name="AutocompleteNoRecommendationsMessage" xml:space="preserve">
<value>There’s no node that we can recommend to you, you may try</value>
</data>
<data name="AutocompleteSwitchToObjectTypeMessage" xml:space="preserve">
<value>switching to Object Type Autocomplete</value>
</data>
<data name="AutocompleteLowConfidenceMessage" xml:space="preserve">
<value>We are not very confident that the nodes below will work, you may try them or</value>
</data>
<data name="AutocompleteLowConfidenceMessageAditional" xml:space="preserve">
<value>to view more options</value>
</data>
<data name="AutocompleteLowConfidenceTooltip" xml:space="preserve">
<value>Low Confidence Tooltip</value>
</data>
</root>
25 changes: 23 additions & 2 deletions src/DynamoCore/Properties/Resources.resx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Expand Down Expand Up @@ -872,4 +872,25 @@ This package likely contains an assembly that is blocked. You will need to load
<data name="SplashScreenLoadNodeLibrary" xml:space="preserve">
<value>Loading Node Library...</value>
</data>
</root>
<data name="AutocompleteNoRecommendationsTitle" xml:space="preserve">
<value>No recommendations</value>
</data>
<data name="AutocompleteLowConfidenceTitle" xml:space="preserve">
<value>Low confidence</value>
</data>
<data name="AutocompleteNoRecommendationsMessage" xml:space="preserve">
<value>There’s no node that we can recommend to you, you may try</value>
</data>
<data name="AutocompleteSwitchToObjectTypeMessage" xml:space="preserve">
<value>switching to Object Type Autocomplete</value>
</data>
<data name="AutocompleteLowConfidenceMessage" xml:space="preserve">
<value>We are not very confident that the nodes below will work, you may try them or</value>
</data>
<data name="AutocompleteLowConfidenceMessageAditional" xml:space="preserve">
<value>to view more options</value>
</data>
<data name="AutocompleteLowConfidenceTooltip" xml:space="preserve">
<value>Low Confidence Tooltip</value>
</data>
</root>
31 changes: 31 additions & 0 deletions src/DynamoCore/Search/SearchElements/NodeSearchElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public abstract class NodeSearchElement : ISearchEntry, ISource<NodeModel>
private bool isVisibleInSearch = true;

internal AutoCompletionNodeElementInfo AutoCompletionNodeElementInfo { get; set; } = new AutoCompletionNodeElementInfo();
/// <summary>
/// Machine Learning related info
/// </summary>
public AutoCompletionNodeMachineLearningInfo AutoCompletionNodeMachineLearningInfo { get; set; } = new AutoCompletionNodeMachineLearningInfo();

/// <summary>
/// Event is fired when a node visibility in library search was changed.
Expand Down Expand Up @@ -293,6 +297,33 @@ internal class AutoCompletionNodeElementInfo
internal int PortToConnect { get; set; }
}

/// <summary>
/// This class will support the Machine Learning info related to a node element of Auto-completion feature.
/// </summary>
public class AutoCompletionNodeMachineLearningInfo
{
/// <summary>
/// Indicates if the user can view the confidence score or the recent use icon
/// </summary>
public Boolean ViewConfidenceScoreRecentUse { get; set; }
/// <summary>
/// Rating of confidence
/// </summary>
public int ConfidenceScore { get; set; }
/// <summary>
/// Indicates if the Node is part of ML result per use
/// </summary>
public Boolean IsByUse { get; set; }
/// <summary>
/// Indicates if the Node is part of the ML result per recommendation
/// </summary>
public Boolean IsByRecommendation
{
get
{ return !IsByUse; }
}
}

/// <summary>
/// This class returns <see cref="NodeSearchElement"/> which is used
/// for creating a node, when the element is drag and dropped.
Expand Down
117 changes: 86 additions & 31 deletions src/DynamoCoreWpf/Controls/NodeAutoCompleteSearchControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<Setter Property="Template"
Value="{StaticResource LibraryScrollViewerControlTemplate}" />
</Style>

<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</ResourceDictionary>
</UserControl.Resources>

Expand Down Expand Up @@ -101,39 +101,94 @@
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</Image>
</StackPanel>
</Grid>
</Border>
</Grid>

<Border Opacity=".9"
Background="{StaticResource LibraryCommonBackground}"
Grid.Row="1"
Name="AutoCompleteCandidates"
MaxHeight="250">
<ListBox Name="MembersListBox"
HorizontalAlignment="Left"
Background="Transparent"
BorderBrush="Transparent"
ItemContainerStyle="{StaticResource SearchMemberStyle}"
ItemsSource="{Binding FilteredResults, NotifyOnTargetUpdated=True}"
TargetUpdated="OnMembersListBoxUpdated"
PreviewMouseWheel="OnMembersListBoxMouseWheel"
Margin="10,0,5,0"
Visibility="Visible">
<ListBox.ItemTemplate>
<DataTemplate>
<ScrollViewer Template="{StaticResource InCanvasScrollViewerControlTemplate}"
Style="{StaticResource InCanvasScrollViewerStyle}"
CanContentScroll="True"
Width="{Binding Source={x:Static resx:Resources.Autocomplete}, Converter={StaticResource NodeAutocompleteWidthConverter}}">
<ContentPresenter ContentTemplate="{StaticResource MemberTemplate}" />
</ScrollViewer>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Border>
<StackPanel Opacity=".9"
Background="{StaticResource LibraryCommonBackground}"
Grid.Row="1"
Name="AutoCompleteCandidates"
MaxHeight="300">
<ListBox Name="MembersListBox"
HorizontalAlignment="Left"
Background="Transparent"
BorderBrush="Transparent"
ItemContainerStyle="{StaticResource SearchMemberStyle}"
ItemsSource="{Binding FilteredResults, NotifyOnTargetUpdated=True}"
TargetUpdated="OnMembersListBoxUpdated"
PreviewMouseWheel="OnMembersListBoxMouseWheel"
Margin="10,0,5,0"
Visibility="Visible">
<ListBox.ItemTemplate>
<DataTemplate>
<ScrollViewer Template="{StaticResource InCanvasScrollViewerControlTemplate}"
Style="{StaticResource InCanvasScrollViewerStyle}"
CanContentScroll="True"
Width="{Binding Source={x:Static resx:Resources.Autocomplete}, Converter={StaticResource NodeAutocompleteWidthConverter}}">
<ContentPresenter ContentTemplate="{StaticResource MemberTemplate}" />
</ScrollViewer>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<StackPanel Visibility="{Binding Path=DisplayNoRecommendationsLowConfidence, Converter={StaticResource BooleanToVisibilityConverter}}">
<Image
Name="DisablePackageInstallIcon"
Width="205"
Height="120"
Margin="0,30,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top" Source="/DynamoCoreWpf;component/UI/Images/no-recommendations.png">
</Image>
<TextBlock Text="{Binding Path=NoRecommendationsOrLowConfidenceTitle}"
Background="Transparent"
Padding="5"
Foreground="{StaticResource AutocompletionWindowFontColor}"
TextAlignment="Center"
FontSize="14">
</TextBlock>
<StackPanel Orientation="Vertical" MaxWidth="250" Margin="0,0,0,30">
<TextBlock Height="auto" TextWrapping="Wrap" FontFamily="{StaticResource ArtifaktElementRegular}" Foreground="#F5F5F5" FontSize="11">
<Run Text="{Binding Path=NoRecommendationsOrLowConfidenceMessage}"
Foreground="{StaticResource AutocompletionWindowFontColor}">
</Run>
<Run Text="{x:Static resx:Resources.AutocompleteSwitchToObjectTypeMessage}"
Foreground="{StaticResource Blue400Brush}">
</Run>
<Run Text="{Binding Path=LowConfidenceMessageAdditional}"
Foreground="{StaticResource AutocompletionWindowFontColor}">
</Run>
</TextBlock>
</StackPanel>
</StackPanel>
<StackPanel x:Name="LowConfidenceSpace" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0,10,0,10"
Visibility="{Binding Path=DisplayLowConfidence, Converter={StaticResource BooleanToVisibilityConverter}}">
<Image HorizontalAlignment="Center"
Height="14"
VerticalAlignment="Center"
Width="14"
Source="pack://application:,,,/DynamoCoreWpf;component/UI/Images/caret_down.png"
Margin="18,0,15,0"/>
<TextBlock
HorizontalAlignment="Left"
FontSize="14"
Text="{x:Static resx:Resources.AutocompleteLowConfidenceTitle}" Foreground="{StaticResource DynamoStandardLabelTextBrush}"/>
<Image
Grid.Column="0"
Margin="10,0,0,0"
Width="14"
Height="14"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource QuestionIcon}"
ToolTipService.ShowDuration="10000">
<Image.ToolTip>
<ToolTip Content="{x:Static resx:Resources.AutocompleteLowConfidenceTooltip}" Style="{StaticResource GenericToolTipLight}"/>
</Image.ToolTip>
</Image>
</StackPanel>
</StackPanel>

<Border Margin="-4,2,-2,2" Grid.RowSpan="2">
<Popup StaysOpen="True"
Expand All @@ -150,7 +205,7 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition/>
</Grid.ColumnDefinitions>
</Grid.ColumnDefinitions>
<Border CornerRadius="8"
BorderThickness="1"
Padding="5"
Expand Down
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -1576,6 +1576,7 @@
<Resource Include="UI\Images\bubble-arrow.png" />
<Resource Include="UI\Images\icon-whats-new-small.png" />
<Resource Include="UI\Images\icon-dictionary-small.png" />
<Resource Include="UI\Images\no-recommendations.png" />
</ItemGroup>
<Target Name="AfterBuildOps" AfterTargets="Build">
<MakeDir Directories="$(OutputPath)\viewExtensions\" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 20 additions & 3 deletions src/DynamoCoreWpf/UI/Themes/Modern/SidebarGridStyleDictionary.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="clr-namespace:Dynamo.UI;assembly=DynamoCoreWpf">

Expand Down Expand Up @@ -233,6 +233,23 @@
<StackPanel Name="ImageAndNodeName"
Orientation="Horizontal"
VerticalAlignment="Center">
<StackPanel Visibility="{Binding Path=Model.AutoCompletionNodeMachineLearningInfo.ViewConfidenceScoreRecentUse, Converter={StaticResource BooleanToVisibilityConverter}}">
<TextBlock
HorizontalAlignment="Center"
Width="24"
FontSize="10"
Margin="5,12,0,0"
Visibility="{Binding Path=Model.AutoCompletionNodeMachineLearningInfo.IsByRecommendation, Converter={StaticResource BooleanToVisibilityConverter}}"
Text="{Binding Model.AutoCompletionNodeMachineLearningInfo.ConfidenceScore, StringFormat= {}{0} %, Mode=OneWay}" Foreground="{StaticResource DynamoStandardLabelTextBrush}">
</TextBlock>
<Image HorizontalAlignment="Center"
Height="14"
VerticalAlignment="Center"
Width="14"
Source="pack://application:,,,/DynamoCoreWpf;component/UI/Images/clock-icon.png"
Margin="7,10,8,0"
Visibility="{Binding Path=Model.AutoCompletionNodeMachineLearningInfo.IsByUse, Converter={StaticResource BooleanToVisibilityConverter}}" />
</StackPanel>
<Image HorizontalAlignment="Left"
Height="36"
Margin="3,0,16,0"
Expand Down Expand Up @@ -392,5 +409,5 @@
<!--EndRegion-->

<!--EndRegion-->

</ResourceDictionary>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
</ResourceDictionary>
Loading