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-4361] Enable Ctrl + C to copy selected data out of preview bubbles/watch nodes #15559

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
96 changes: 63 additions & 33 deletions src/DynamoCoreWpf/Views/Preview/InfoBubbleView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,22 @@
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<!-- Displays the warning message -->
<TextBlock LineHeight="14px" TextWrapping="Wrap">
<TextBlock.Inlines>
<Run FontFamily="{StaticResource ArtifaktElementBold}" Text="{Binding MessageNumber, UpdateSourceTrigger=PropertyChanged}" />
<Run Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
</TextBlock.Inlines>
</TextBlock>
<Grid>
<!-- TextBox for the numbering -->
<TextBox Text="{Binding MessageNumber, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource ArtifaktElementBold}"
IsReadOnly="True"
Background="Transparent"
BorderThickness="0"/>
<!-- TextBox for the message description -->
<TextBox Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource ArtifaktElementRegular}"
TextWrapping="Wrap"
IsReadOnly="True"
Background="Transparent"
BorderThickness="0"
Margin="30,0,0,0"/>
</Grid>
</Grid>
<Button Name="LearnMoreErrorsButton"
Margin="-2,4,0,0"
Expand Down Expand Up @@ -221,11 +231,11 @@
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<!-- Displays the warning message -->
<TextBlock LineHeight="14px" TextWrapping="Wrap">
<TextBlock.Inlines>
<Run Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
</TextBlock.Inlines>
</TextBlock>
<TextBox IsReadOnly="True"
Background="Transparent"
BorderThickness="0"
TextWrapping="Wrap"
Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
<Button Name="LearnMoreErrorsButton"
Margin="-2,4,0,0"
Expand Down Expand Up @@ -394,12 +404,22 @@
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<!-- Displays the warning message -->
<TextBlock LineHeight="14px" TextWrapping="Wrap">
<TextBlock.Inlines>
<Run FontFamily="{StaticResource ArtifaktElementBold}" Text="{Binding MessageNumber, UpdateSourceTrigger=PropertyChanged}" />
<Run Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
</TextBlock.Inlines>
</TextBlock>
<Grid>
<!-- TextBox for the numbering -->
<TextBox Text="{Binding MessageNumber, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource ArtifaktElementBold}"
IsReadOnly="True"
Background="Transparent"
BorderThickness="0"/>
<!-- TextBox for the message description -->
<TextBox Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource ArtifaktElementRegular}"
TextWrapping="Wrap"
IsReadOnly="True"
Background="Transparent"
BorderThickness="0"
Margin="30,0,0,0"/>
</Grid>
<Button Name="DismissMessageButton"
Grid.Column="1"
Width="13"
Expand Down Expand Up @@ -466,11 +486,11 @@
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<!-- Displays the warning message -->
<TextBlock LineHeight="14px" TextWrapping="Wrap">
<TextBlock.Inlines>
<Run Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
</TextBlock.Inlines>
</TextBlock>
<TextBox IsReadOnly="True"
Background="Transparent"
BorderThickness="0"
TextWrapping="Wrap"
Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
<Button Name="DismissMessageButton"
Grid.Column="1"
Width="13"
Expand Down Expand Up @@ -669,12 +689,22 @@
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<!-- Displays the warning message -->
<TextBlock LineHeight="14px" TextWrapping="Wrap">
<TextBlock.Inlines>
<Run FontFamily="{StaticResource ArtifaktElementBold}" Text="{Binding MessageNumber, UpdateSourceTrigger=PropertyChanged}" />
<Run Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
</TextBlock.Inlines>
</TextBlock>
<Grid>
<!-- TextBox for the numbering -->
<TextBox Text="{Binding MessageNumber, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource ArtifaktElementBold}"
IsReadOnly="True"
Background="Transparent"
BorderThickness="0"/>
<!-- TextBox for the message description -->
<TextBox Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}"
FontFamily="{StaticResource ArtifaktElementRegular}"
TextWrapping="Wrap"
IsReadOnly="True"
Background="Transparent"
BorderThickness="0"
Margin="30,0,0,0"/>
</Grid>
<Button Name="DismissMessageButton"
Grid.Column="1"
Width="13"
Expand Down Expand Up @@ -737,11 +767,11 @@
<ColumnDefinition Width="30" />
</Grid.ColumnDefinitions>
<!-- Displays the warning message -->
<TextBlock LineHeight="14px" TextWrapping="Wrap">
<TextBlock.Inlines>
<Run Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
</TextBlock.Inlines>
</TextBlock>
<TextBox IsReadOnly="True"
Background="Transparent"
BorderThickness="0"
TextWrapping="Wrap"
Text="{Binding Message, UpdateSourceTrigger=PropertyChanged}" />
<Button Name="DismissMessageButton"
Grid.Column="1"
Width="13"
Expand Down
20 changes: 12 additions & 8 deletions src/DynamoCoreWpf/Views/Preview/WatchTree.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -352,19 +352,23 @@
</TextBlock.Style>
</TextBlock>

<TextBlock Width="Auto"
Margin="{Binding Path=IsTopLevel, Converter={StaticResource TopLevelLabelMarginConverter}}"
VerticalAlignment="Center"
FontFamily="{StaticResource SourceCodePro}"
Text="{Binding Path=NodeLabel}"
Visibility="{Binding Path=NodeLabel, Converter={StaticResource EmptyStringToCollapsedConverter}}" >
<TextBox Width="Auto"
Margin="{Binding Path=IsTopLevel, Converter={StaticResource TopLevelLabelMarginConverter}}"
VerticalAlignment="Center"
FontFamily="{StaticResource SourceCodePro}"
Text="{Binding Path=NodeLabel}"
Visibility="{Binding Path=NodeLabel, Converter={StaticResource EmptyStringToCollapsedConverter}}"
IsReadOnly="True"
Background="Transparent"
BorderThickness="0"
TextWrapping="Wrap">
<TextBlock.Foreground>
<MultiBinding Converter="{StaticResource ObjectTypeConverter}">
<Binding Path="ValueType" />
<Binding Path="NodeLabel" />
</MultiBinding>
</MultiBinding>
</TextBlock.Foreground>
</TextBlock>
</TextBox>

<Button Margin="10,2,2,2"
Padding="4,0,4,0"
Expand Down
21 changes: 16 additions & 5 deletions test/DynamoCoreWpfTests/NodeViewCustomizationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,12 @@ public void WatchContainsExpectedUiElements()
var tree = nodeView.ChildrenOfType<WatchTree>();
Assert.AreEqual(1, tree.Count());

var items = tree.First().treeView1.ChildrenOfType<TextBlock>();
Assert.AreEqual(8, items.Count());
// text block for list indexes
var textBlocks = tree.First().treeView1.ChildrenOfType<TextBlock>();
Assert.AreEqual(4, textBlocks.Count());
// text boxes for list items
var textBoxes = tree.First().treeView1.ChildrenOfType<TextBox>();
Assert.AreEqual(4, textBoxes.Count());
}

[Test, Category("DisplayHardwareDependent")]
Expand Down Expand Up @@ -437,7 +441,12 @@ public void WatchConnectDisconnectTest()

var items = tree.First().treeView1.ChildrenOfType<TextBlock>();
// watch is computed with cbn and has its value
Assert.AreEqual(8, items.Count());
// text block for list indexes
var textBlocks = tree.First().treeView1.ChildrenOfType<TextBlock>();
Assert.AreEqual(4, textBlocks.Count());
// text boxes for list items
var textBoxes = tree.First().treeView1.ChildrenOfType<TextBox>();
Assert.AreEqual(4, textBoxes.Count());

// disconnect watch
Model.ExecuteCommand(new DynamoModel.MakeConnectionCommand(watchGuid, 0, PortType.Input,
Expand All @@ -464,8 +473,10 @@ public void WatchConnectDisconnectTest()
Run();
DispatcherUtil.DoEvents();
tree = nodeView.ChildrenOfType<WatchTree>();
items = tree.First().treeView1.ChildrenOfType<TextBlock>();
Assert.AreEqual(8, items.Count());
textBlocks = tree.First().treeView1.ChildrenOfType<TextBlock>();
Assert.AreEqual(4, textBlocks.Count());
textBoxes = tree.First().treeView1.ChildrenOfType<TextBox>();
Assert.AreEqual(4, textBoxes.Count());
}

[Test]
Expand Down
Loading