Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ launchSettings.json
# IDE #
###############
.idea
.vscode/

#documentation files
doc/html/
Expand Down
15 changes: 13 additions & 2 deletions src/DynamoCoreWpf/Commands/InfoBubbleCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Dynamo.UI.Commands;
using Dynamo.UI.Commands;

namespace Dynamo.ViewModels
{
Expand All @@ -13,6 +13,17 @@ public partial class InfoBubbleViewModel : ViewModelBase
private DelegateCommand openDocumentationLinkCommand;
private DelegateCommand dismissMessageCommand;
private DelegateCommand undismissMessageCommand;
private DelegateCommand copyTextToClipboardCommand;

public DelegateCommand CopyTextToClipboardCommand
{
get
{
if (copyTextToClipboardCommand == null)
copyTextToClipboardCommand = new DelegateCommand(CopyTextToClipboard, CanCopyTextToClipboard);
return copyTextToClipboardCommand;
}
}

public DelegateCommand UpdateContentCommand
{
Expand Down Expand Up @@ -127,4 +138,4 @@ public DelegateCommand UndismissMessageCommand
}
}
}
}
}
4 changes: 4 additions & 0 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@
<None Remove="UI\Images\close_16px.png" />
<None Remove="UI\Images\caret_drop_down.png" />
<None Remove="UI\Images\error_48px.png" />
<None Remove="UI\Images\copy_16px_default.png" />
<None Remove="UI\Images\copy_16px_hover.png" />
<None Remove="UI\Images\file-generic-16px.png" />
<None Remove="UI\Images\finished_checkmark_30px.png" />
<None Remove="UI\Images\folder-generic-16px.png" />
Expand Down Expand Up @@ -1323,6 +1325,8 @@
<Resource Include="UI\Images\closetab_normal.png" />
<Resource Include="UI\Images\dynamonotext.png" />
<Resource Include="UI\Images\error_48px.png" />
<Resource Include="UI\Images\copy_16px_default.png" />
<Resource Include="UI\Images\copy_16px_hover.png" />
<Resource Include="UI\Images\file-generic-16px.png" />
<Resource Include="UI\Images\finished_checkmark_30px.png" />
<Resource Include="UI\Images\folder-generic-16px.png" />
Expand Down
42 changes: 30 additions & 12 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

8 changes: 7 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ Don't worry, you'll have the option to save your work.</value>
<data name="DownloadWarningMessageBoxTitle" xml:space="preserve">
<value>Download Warning</value>
</data>
<data name="CopyToClipboardTooltip" xml:space="preserve">
<value>Copy to clipboard</value>
</data>
<data name="CopyToClipboardFailedMessage" xml:space="preserve">
<value>Copy to clipboard failed</value>
</data>
<data name="DynamoUpdateAvailableToolTip" xml:space="preserve">
<value>A Dynamo update is available. Click to install.</value>
</data>
Expand Down Expand Up @@ -4170,4 +4176,4 @@ To make this file into a new template, save it to a different folder, then move
<value>Node Icon Data is dumped to \"{0}\".</value>
<comment>Debug menu | Dump all node icons</comment>
</data>
</root>
</root>
8 changes: 7 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,13 @@ Don't worry, you'll have the option to save your work.</value>
<data name="DownloadWarningMessageBoxTitle" xml:space="preserve">
<value>Download Warning</value>
</data>
<data name="DynamoUpdateAvailableToolTip" xml:space="preserve">
<data name="CopyToClipboardTooltip" xml:space="preserve">
<value>Copy to clipboard</value>
</data>
<data name="CopyToClipboardFailedMessage" xml:space="preserve">
<value>Copy to clipboard failed</value>
</data>
<data name="DynamoUpdateAvailableToolTip" xml:space="preserve">
Comment thread
jasonstratton marked this conversation as resolved.
<value>A Dynamo update is available. Click to install.</value>
</data>
<data name="EditNodeWindowTitle" xml:space="preserve">
Expand Down
3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,7 @@ Dynamo.ViewModels.InfoBubbleViewModel.ConnectingDirection.get -> Dynamo.ViewMode
Dynamo.ViewModels.InfoBubbleViewModel.ConnectingDirection.set -> void
Dynamo.ViewModels.InfoBubbleViewModel.Content.get -> string
Dynamo.ViewModels.InfoBubbleViewModel.Content.set -> void
Dynamo.ViewModels.InfoBubbleViewModel.CopyTextToClipboardCommand.get -> Dynamo.UI.Commands.DelegateCommand
Dynamo.ViewModels.InfoBubbleViewModel.Direction
Dynamo.ViewModels.InfoBubbleViewModel.Direction.Bottom = 4 -> Dynamo.ViewModels.InfoBubbleViewModel.Direction
Dynamo.ViewModels.InfoBubbleViewModel.Direction.BottomLeft = 7 -> Dynamo.ViewModels.InfoBubbleViewModel.Direction
Expand Down Expand Up @@ -4618,6 +4619,8 @@ static Dynamo.Wpf.Properties.Resources.ContinueInstall.get -> string
static Dynamo.Wpf.Properties.Resources.ConverterMessageCurrentOffset.get -> string
static Dynamo.Wpf.Properties.Resources.ConverterMessageTransformOrigin.get -> string
static Dynamo.Wpf.Properties.Resources.ConverterMessageZoom.get -> string
static Dynamo.Wpf.Properties.Resources.CopyToClipboardTooltip.get -> string
static Dynamo.Wpf.Properties.Resources.CopyToClipboardFailedMessage.get -> string
static Dynamo.Wpf.Properties.Resources.CrashPromptDialogCopyButton.get -> string
static Dynamo.Wpf.Properties.Resources.CrashPromptDialogCrashMessage.get -> string
static Dynamo.Wpf.Properties.Resources.CrashPromptDialogDetailButton.get -> string
Expand Down
Binary file added src/DynamoCoreWpf/UI/Images/copy_16px_default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/DynamoCoreWpf/UI/Images/copy_16px_hover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 36 additions & 1 deletion src/DynamoCoreWpf/ViewModels/Preview/InfoBubbleViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Input;
using Dynamo.Logging;
using Dynamo.UI.Commands;
using Dynamo.Wpf.ViewModels.Core;

namespace Dynamo.ViewModels
Expand Down Expand Up @@ -65,7 +67,7 @@ public enum State
// In order to stay above these, we need a high ZIndex value.
private double zIndex;
private Style infoBubbleStyle;

Comment thread
jasonstratton marked this conversation as resolved.
[Obsolete]
public Direction connectingDirection;

Expand Down Expand Up @@ -506,6 +508,39 @@ private void InitializeInfoBubble(DynamoViewModel dynamoViewModel)

RefreshNodeInformationalStateDisplay();
}

/// <summary>
/// Copies the text of an info bubble message to the clipboard
/// </summary>
/// <param name="parameter">The InfoBubbleDataPacket to copy</param>
private void CopyTextToClipboard(object parameter)
{
if (parameter is InfoBubbleDataPacket infoBubbleDataPacket)
{
try
{
System.Windows.Clipboard.SetText(infoBubbleDataPacket.Text);
Analytics.TrackEvent(Actions.Copy, Categories.NodeOperations,
infoBubbleDataPacket.Style.ToString(), 1);
}
catch (Exception ex)
{
DynamoViewModel.Model.Logger.Log(Wpf.Properties.Resources.CopyToClipboardFailedMessage);
DynamoViewModel.Model.Logger.Log(ex.Message);
}
}
}

/// <summary>
/// Determines if a message can be copied to clipboard
/// </summary>
/// <param name="parameter">The InfoBubbleDataPacket to check</param>
/// <returns>True if the message can be copied</returns>
private bool CanCopyTextToClipboard(object parameter)
{
return parameter is InfoBubbleDataPacket infoBubbleDataPacket &&
!string.IsNullOrEmpty(infoBubbleDataPacket.Text);
}

#endregion

Expand Down
64 changes: 61 additions & 3 deletions src/DynamoCoreWpf/Views/Preview/InfoBubbleView.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="Dynamo.Controls.InfoBubbleView"
<UserControl x:Class="Dynamo.Controls.InfoBubbleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:Dynamo.Controls"
Expand Down Expand Up @@ -34,8 +34,39 @@
To="0"
Duration="0:0:.25" />
</Storyboard>
<Style x:Key="InfoBubbleCopyTextButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0,0,0,0"/>
<Setter Property="Width" Value="16"/>
<Setter Property="Height" Value="16"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="ToolTip" Value="{x:Static p:Resources.CopyToClipboardTooltip}" />
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Image x:Name="CopyIcon"
Width="16" Height="16"
Source="/DynamoCoreWpf;component/UI/Images/copy_16px_default.png"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="False">
<Setter TargetName="CopyIcon" Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_default.png"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="CopyIcon" Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_hover.png"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="CopyIcon" Property="Opacity" Value="0.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

</UserControl.Resources>
<Canvas x:Name="mainCanvas">
<Grid x:Name="mainGrid" Margin="10">
Expand Down Expand Up @@ -127,6 +158,15 @@
Foreground="Black"
Text="{x:Static p:Resources.InfoBubbleError}"
Visibility="{Binding NodeErrorsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
<!-- Copy to Clipboard Button -->
Comment thread
aparajit-pratap marked this conversation as resolved.
<Button
Grid.Row="0"
Grid.Column="2"
Visibility="{Binding NodeErrorsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
Style="{StaticResource InfoBubbleCopyTextButtonStyle}"
Command="{Binding ElementName=InfoBubbleWindowUserControl, Path=DataContext.CopyTextToClipboardCommand}"
CommandParameter="{Binding NodeErrorsToDisplay[0]}"
/>
</Grid>
<!-- Error Info -->
<ScrollViewer Grid.Row="1"
Expand Down Expand Up @@ -366,6 +406,15 @@
Foreground="Black"
Text="{x:Static p:Resources.InfoBubbleWarning}"
Visibility="{Binding NodeWarningsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
<!-- Copy to Clipboard Button -->
<Button
Grid.Row="0"
Grid.Column="2"
Visibility="{Binding NodeWarningsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
Style="{StaticResource InfoBubbleCopyTextButtonStyle}"
Command="{Binding ElementName=InfoBubbleWindowUserControl, Path=DataContext.CopyTextToClipboardCommand}"
CommandParameter="{Binding NodeWarningsToDisplay[0]}"
/>
</Grid>

<!-- Warning Info -->
Expand Down Expand Up @@ -653,10 +702,19 @@
Foreground="Black"
Text="{x:Static p:Resources.InfoBubbleInfo}"
Visibility="{Binding NodeInfoSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
<!-- Copy to Clipboard Button -->
<Button
Grid.Row="0"
Grid.Column="2"
Visibility="{Binding NodeInfoSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
Style="{StaticResource InfoBubbleCopyTextButtonStyle}"
Command="{Binding ElementName=InfoBubbleWindowUserControl, Path=DataContext.CopyTextToClipboardCommand}"
CommandParameter="{Binding NodeInfoToDisplay[0]}"
/>
</Grid>
<!-- Info Info -->
<ScrollViewer Grid.Row="1"
MaxHeight="200"
MaxHeight="200"
Comment thread
jasonstratton marked this conversation as resolved.
PreviewMouseWheel="ScrollViewer_PreviewMouseWheel"
VerticalScrollBarVisibility="Auto">
<ListBox Margin="0,5,0,0"
Expand Down
Loading