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-7334] Improvements following the feedback #57

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 2 additions & 5 deletions TuneUp/TuneUpViewExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using System.Windows.Controls;
using Dynamo.Wpf.Extensions;
using Dynamo.Wpf.Properties;

namespace TuneUp
{
Expand Down Expand Up @@ -62,11 +63,7 @@ public override void Loaded(ViewLoadedParams p)

// Add this view extension's menu item to the Extensions tab or View tab accordingly.
var dynamoMenuItems = p.dynamoMenu.Items.OfType<MenuItem>();
// TODO: Investigate why TuneUpMenuItem is not added to the specified MenuItem
// When _Extensions is specified, TuneUpMenuItem goes to the View menu in Dynamo 3.0-
// and does not appear in Dynamo 3.1+.
// We need to specify _View for TuneUpMenuItem to be added to the Extensions menu
var extensionsMenuItem = dynamoMenuItems.Where(item => item.Header.ToString() == "_View");
var extensionsMenuItem = dynamoMenuItems.Where(item => item.Header.ToString() == Resources.DynamoViewExtensionsMenu);
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏻


if (extensionsMenuItem.Count() > 0)
{
Expand Down
101 changes: 57 additions & 44 deletions TuneUp/TuneUpWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
<local:IsGroupToMarginMultiConverter x:Key="IsGroupToMarginMultiConverter" />
<local:IsGroupToVisibilityMultiConverter x:Key="IsGroupToVisibilityMultiConverter" />
<local:ExecutionOrderNumberVisibilityConverter x:Key="ExecutionOrderNumberVisibilityConverter" />
<local:IsGroupToColorBrushConverter x:Key="IsGroupToColorBrushConverter" />
<local:IsGroupToColorBrushMultiConverter x:Key="IsGroupToColorBrushMultiConverter" />
<local:IsInGroupToColorBrushMultiConverter x:Key="IsInGroupToColorBrushMultiConverter" />
<local:IsRenamedToVisibilityMultiConverter x:Key="IsRenamedToVisibilityMultiConverter" />
<local:ExecutionOrderNumberConverter x:Key="ExecutionOrderNumberConverter" />
<local:ContainsStringConverter x:Key="ContainsStringConverter" />

<local:IsGroupAndBackgroundToForegroundConverter x:Key="IsGroupAndBackgroundToForegroundConverter" />
<!-- ERROR : DYNAMO CRASHES WHEN REFERENCED FROM DYNAMOCOREWPF -->
<Color x:Key="BorderColorTuneUp">#555555</Color>
<SolidColorBrush x:Key="BorderColorBrushTuneUp" Color="{StaticResource BorderColorTuneUp}" />
Expand Down Expand Up @@ -71,37 +70,33 @@
<Setter Property="FontFamily" Value="{StaticResource ArtifaktElementRegular}" />
<Setter Property="FontSize" Value="10" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Margin" Value="5,0,7,0" />
<Setter Property="Margin" Value="5,0,5,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter
x:Name="HeaderContent"
Grid.Column="1"
Margin="11,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center" />
<DockPanel LastChildFill="False" HorizontalAlignment="Left">
<!-- Sort Arrow -->
<Path
x:Name="SortArrow"
Grid.Column="0"
Width="7"
Height="6"
Margin="0,0,4,0"
Margin="5,0,0,0"
VerticalAlignment="Center"
Data="M0,0 L0,2 L4,6 L8,2 L8,0 L4,4 z"
Fill="{StaticResource UnSelectedLayoutForeground}"
RenderTransformOrigin="0.5,0.5"
Stretch="Fill"
Visibility="Collapsed" />
</Grid>
Visibility="Collapsed"
DockPanel.Dock="Right" />
<!-- Header Content -->
<ContentPresenter
x:Name="HeaderContent"
HorizontalAlignment="Left"
VerticalAlignment="Center"
DockPanel.Dock="Left" />
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="SortDirection" Value="Ascending">
<Setter TargetName="HeaderContent" Property="Margin" Value="0" />
<Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
<Setter TargetName="SortArrow" Property="RenderTransform">
<Setter.Value>
Expand All @@ -110,7 +105,6 @@
</Setter>
</Trigger>
<Trigger Property="SortDirection" Value="Descending">
<Setter TargetName="HeaderContent" Property="Margin" Value="0" />
<Setter TargetName="SortArrow" Property="Visibility" Value="Visible" />
<Setter TargetName="SortArrow" Property="RenderTransform">
<Setter.Value>
Expand Down Expand Up @@ -149,7 +143,7 @@
<!-- TextBlock style for DataGrid columns -->
<Style x:Key="DataGridTextBlockStyle" TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Margin" Value="10,0,10,0" />
<Setter Property="Margin" Value="6,0,5,0" />
<Setter Property="Foreground" Value="{StaticResource DarkThemeBodyMediumBrush}" />
<Style.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Path=IsMouseOver}" Value="True">
Expand All @@ -176,12 +170,12 @@
<DataTemplate x:Key="NodeNameTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="7" />
<ColumnDefinition Width="8" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" MinWidth="8" />
</Grid.ColumnDefinitions>
<!-- Group indicator -->
<Border Grid.Column="0" Margin="4,0,0,0">
<Border Grid.Column="0" Margin="5,0,0,0">
<Border.Background>
<MultiBinding Converter="{StaticResource IsInGroupToColorBrushMultiConverter}" Mode="OneWay">
<Binding Path="IsGroup" />
Expand Down Expand Up @@ -217,7 +211,10 @@
</MultiBinding>
</TextBlock.Margin>
<TextBlock.Foreground>
<Binding Converter="{StaticResource IsGroupToColorBrushConverter}" Path="IsGroup" />
<MultiBinding Converter="{StaticResource IsGroupAndBackgroundToForegroundConverter}">
<Binding Path="IsGroup" />
<Binding Path="BackgroundBrush" />
</MultiBinding>
</TextBlock.Foreground>
</TextBlock>
</Border>
Expand All @@ -242,7 +239,7 @@
<ToolTip Style="{StaticResource GenericToolTipLight}">
<TextBlock>
<TextBlock.Text>
<Binding Path="OriginalName" StringFormat="Node original name:&#x0a;{0}" />
<Binding Path="OriginalName" StringFormat="Original node name:&#x0a;{0}" />
</TextBlock.Text>
</TextBlock>
</ToolTip>
Expand Down Expand Up @@ -284,16 +281,15 @@
<!-- TextBlock style for collection footer -->
<Style x:Key="CollectionFooterTextBlockStyle" TargetType="TextBlock">
<Setter Property="Height" Value="20"/>
<Setter Property="Width" Value="120"/>
<Setter Property="Margin" Value="10,0,0,0"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Padding" Value="10,0,0,0"/>
<Setter Property="FontFamily" Value="{StaticResource ArtifaktElementBold}"/>
</Style>
<!-- TextBlock style for collection header -->
<Style x:Key="CollectionHeaderTextBlockStyle" TargetType="TextBlock">
<Setter Property="Height" Value="20"/>
<Setter Property="FontSize" Value="12"/>
<Setter Property="Margin" Value="5,0,0,0"/>
<Setter Property="FontWeight" Value="Normal"/>
</Style>
<!-- Button style *** -->
<!-- PackageManager\Controls\ControlColorsAndBrushes -->
Expand Down Expand Up @@ -391,9 +387,9 @@
<TextBlock Width="70"
Margin="5,0,0,0"
Text="Total"
FontWeight="Bold"/>
FontFamily="{StaticResource ArtifaktElementBold}"/>
<TextBlock Text="{Binding Path=TotalGraphExecutionTime, Mode=OneWay}"
FontWeight="Bold"/>
FontFamily="{StaticResource ArtifaktElementBold}"/>
</StackPanel>
</StackPanel>
<!-- Show Groups Button -->
Expand All @@ -409,17 +405,17 @@
IsChecked="{Binding ShowGroups, Mode=TwoWay}"
IsEnabled="True"
Style="{StaticResource EllipseToggleButton1}" />
<TextBlock Margin="5,0,0,0"
<TextBlock Margin="5,0,7,0"
Text="Show groups">
</TextBlock>
<Rectangle Width="16"
<!--<Rectangle Width="16"
Height="16"
Margin="10,0,7,0"
VerticalAlignment="Center">
<Rectangle.Fill>
<ImageBrush ImageSource="/DynamoCoreWpf;component/UI/Images/help-16px.png" />
</Rectangle.Fill>
</Rectangle>
</Rectangle>-->
</StackPanel>
<!-- Run All Button -->
<Button Grid.Row="1"
Expand All @@ -444,14 +440,17 @@
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel >
<!-- Latest Run -->
<TextBlock Text="Latest Run"
<TextBlock Text="Latest run"
Style="{StaticResource CollectionHeaderTextBlockStyle}"
Visibility="{Binding LatestRunTableVisibility}"/>
<DataGrid ItemsSource="{Binding Path=ProfiledNodesCollectionLatestRun.View}"
x:Name="LatestRunTable"
Style="{StaticResource DataGridStyleTuneUpCombined}"
AlternatingRowBackground="#434343"
Sorting="LatestRunTable_Sorting">
Sorting="LatestRunTable_Sorting"
SelectionChanged="NodeAnalysisTable_SelectionChanged"
PreviewMouseDown="NodeAnalysisTable_PreviewMouseDown"
MouseLeave="NodeAnalysisTable_MouseLeave">
<DataGrid.Columns>
<!-- Execution Order -->
<DataGridTextColumn Width="40"
Expand All @@ -472,7 +471,7 @@
<!-- Execution Time -->
<DataGridTextColumn Width="120"
Binding="{Binding ExecutionMilliseconds}"
Header="Execution Time (ms)"
Header="Execution time (ms)"
IsReadOnly="True">
<DataGridTextColumn.ElementStyle>
<Style BasedOn="{StaticResource ExecutionTimeTextBlockStyle}" TargetType="TextBlock"/>
Expand All @@ -483,20 +482,27 @@
<StackPanel Style="{StaticResource CollectionFooterStackPanelStyle}"
Visibility="{Binding LatestRunTableVisibility}">
<TextBlock Text="Total"
Style="{StaticResource CollectionHeaderTextBlockStyle}"/>
<TextBlock Text="{Binding Path=LatestGraphExecutionTime, Mode=OneWay}"
Style="{StaticResource CollectionFooterTextBlockStyle}"/>
<TextBlock Text="{Binding Path=LatestGraphExecutionTime, Mode=OneWay}"
Style="{StaticResource CollectionFooterTextBlockStyle}"
Width="120"
HorizontalAlignment="Left"
Margin="10,0,0,0"
Padding="7,0,0,0"/>
</StackPanel>
<!-- Previous Run -->
<TextBlock Text="Previous Run"
<TextBlock Text="Previous run"
Style="{StaticResource CollectionHeaderTextBlockStyle}"
Visibility="{Binding PreviousRunTableVisibility}"/>
<DataGrid ItemsSource="{Binding Path=ProfiledNodesCollectionPreviousRun.View}"
x:Name="PreviousRunTable"
Style="{StaticResource DataGridStyleTuneUpCombined}"
AlternatingRowBackground="#434343"
HeadersVisibility="None"
Sorting="LatestRunTable_Sorting">
Sorting="LatestRunTable_Sorting"
SelectionChanged="NodeAnalysisTable_SelectionChanged"
PreviewMouseDown="NodeAnalysisTable_PreviewMouseDown"
MouseLeave="NodeAnalysisTable_MouseLeave">
<DataGrid.Columns>
<!--Execution Order-->
<DataGridTextColumn Width="40"
Expand Down Expand Up @@ -524,12 +530,16 @@
<StackPanel Style="{StaticResource CollectionFooterStackPanelStyle}"
Visibility="{Binding PreviousRunTableVisibility}">
<TextBlock Text="Total"
Style="{StaticResource CollectionHeaderTextBlockStyle}"/>
Style="{StaticResource CollectionFooterTextBlockStyle}"/>
<TextBlock Text="{Binding Path=PreviousGraphExecutionTime, Mode=OneWay}"
Style="{StaticResource CollectionFooterTextBlockStyle}" />
Style="{StaticResource CollectionFooterTextBlockStyle}"
Width="120"
HorizontalAlignment="Left"
Margin="10,0,0,0"
Padding="7,0,0,0"/>
</StackPanel>
<!-- Not Executed -->
<TextBlock Text="Not Executed"
<TextBlock Text="Not executed"
Style="{StaticResource CollectionHeaderTextBlockStyle}"
Visibility="{Binding NotExecutedTableVisibility}"/>
<DataGrid ItemsSource="{Binding Path=ProfiledNodesCollectionNotExecuted.View}"
Expand All @@ -539,7 +549,10 @@
AlternatingRowBackground="#434343"
HeadersVisibility="None"
CanUserSortColumns="False"
Sorting="NotExecutedTable_Sorting">
Sorting="NotExecutedTable_Sorting"
SelectionChanged="NodeAnalysisTable_SelectionChanged"
PreviewMouseDown="NodeAnalysisTable_PreviewMouseDown"
MouseLeave="NodeAnalysisTable_MouseLeave">
<DataGrid.Columns>
<!--Execution Order-->
<DataGridTextColumn Width="40"/>
Expand Down
Loading