-
Notifications
You must be signed in to change notification settings - Fork 635
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
Add and update icons and Update icon automation (debug mode) #14942
Changes from all commits
3897597
ddabb04
80c936b
a1c0dc2
1df16dd
ce336f6
440323f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,8 @@ | |
using System.Windows.Controls.Primitives; | ||
using System.Windows.Data; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Xml.Linq; | ||
using Dynamo.Configuration; | ||
using Dynamo.Graph.Nodes; | ||
using Dynamo.Graph.Workspaces; | ||
|
@@ -3370,6 +3372,35 @@ | |
} | ||
} | ||
|
||
public class Base64ToImageConverter : IValueConverter | ||
Check failure on line 3375 in src/DynamoCoreWpf/UI/Converters.cs GitHub Actions / analyze
|
||
{ | ||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
if (value == null) return null; | ||
|
||
string s = string.Empty; | ||
if (value is string) | ||
{ | ||
s = value as string; | ||
} | ||
|
||
if (string.IsNullOrEmpty(s)) return null; | ||
|
||
BitmapImage bi = new BitmapImage(); | ||
|
||
bi.BeginInit(); | ||
bi.StreamSource = new MemoryStream(System.Convert.FromBase64String(s)); | ||
bi.EndInit(); | ||
|
||
return bi; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Converter is used in WatchTree.xaml | ||
/// It converts the boolean value of WatchViewModel.IsCollection to determine the margin of the listnode textblock | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Windows; | ||
using Dynamo.Utilities; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
<Window x:Class="Dynamo.Wpf.Views.Debug.UpdateNodeIconsWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:p="clr-namespace:Dynamo.Wpf.Properties" | ||
Title="Update Node Icons" | ||
ResizeMode="NoResize" Width="750" Height="600" | ||
xmlns:local="clr-namespace:Dynamo.Controls" | ||
> | ||
<Window.Resources> | ||
<local:Base64ToImageConverter x:Key="Base64ToImageConverter"/> | ||
</Window.Resources> | ||
<StackPanel Orientation="Vertical" Margin="10 0 10 0"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" SharedSizeGroup="Label"/> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="*"/> | ||
</Grid.RowDefinitions> | ||
<Label Grid.Row="0">Enter New Icon Sources:</Label> | ||
<TextBox Grid.Row="1" | ||
TextWrapping="Wrap" | ||
AcceptsTab="True" | ||
MinLines="3" | ||
MinHeight="25" | ||
MaxHeight="60" | ||
Padding="3" | ||
Text ="{Binding NewIconPaths}"></TextBox> | ||
<TextBox Grid.Row="2" IsReadOnly="True" Margin="0 10" | ||
Background="AliceBlue" | ||
Name="OutputText" BorderThickness="0" | ||
MaxHeight="105" Text ="{Binding Output, Mode=TwoWay}"></TextBox> | ||
</Grid> | ||
<Grid> | ||
<ScrollViewer Margin="10,5,10,0" Height="320"> | ||
<DataGrid ItemsSource="{Binding UpdatedIconList}" | ||
AutoGenerateColumns="False" | ||
Name="IconGrid" | ||
CanUserAddRows="False" | ||
CanUserDeleteRows="False" | ||
CanUserReorderColumns="False" | ||
CanUserResizeColumns="False" | ||
CanUserResizeRows="False" | ||
CanUserSortColumns="False" | ||
SelectionMode="Single" | ||
SelectionUnit="FullRow" | ||
IsReadOnly="True" | ||
RowHeaderWidth="0" | ||
HorizontalScrollBarVisibility="Auto" | ||
VerticalScrollBarVisibility="Auto"> | ||
<DataGrid.Resources> | ||
<Style TargetType="{x:Type DataGridRow}"> | ||
<Setter Property="Background" Value="#434343"/> | ||
<Setter Property="Foreground" Value="#ccc"/> | ||
</Style> | ||
<Style TargetType="{x:Type DataGridColumnHeader}"> | ||
<Setter Property="Background" Value="#535353"/> | ||
<Setter Property="Foreground" Value="#ccc"/> | ||
</Style> | ||
</DataGrid.Resources> | ||
|
||
<DataGrid.Columns> | ||
<DataGridTemplateColumn Header="Node Name" Width="*"> | ||
<DataGridTemplateColumn.CellTemplate> | ||
<DataTemplate> | ||
<TextBlock> | ||
<Run Text="{Binding NodeName}" /> | ||
<LineBreak/> | ||
<Run Text="(" /> | ||
<Run Text="{Binding IconSuffix}" /> | ||
<Run Text=")" /> | ||
</TextBlock> | ||
</DataTemplate> | ||
</DataGridTemplateColumn.CellTemplate> | ||
</DataGridTemplateColumn> | ||
|
||
<DataGridTemplateColumn Header="Old Icon" Width="*"> | ||
<DataGridTemplateColumn.CellTemplate> | ||
<DataTemplate> | ||
<Image Source="{Binding OldData, Converter={StaticResource Base64ToImageConverter}}" Width="40" Height="40"/> | ||
</DataTemplate> | ||
</DataGridTemplateColumn.CellTemplate> | ||
</DataGridTemplateColumn> | ||
<DataGridTemplateColumn Header="New Icon" Width="*"> | ||
<DataGridTemplateColumn.CellTemplate> | ||
<DataTemplate> | ||
<Image Source="{Binding Icon_Base64String, Converter={StaticResource Base64ToImageConverter}}" Width="40" Height="40"/> | ||
</DataTemplate> | ||
</DataGridTemplateColumn.CellTemplate> | ||
</DataGridTemplateColumn> | ||
</DataGrid.Columns> | ||
</DataGrid> | ||
|
||
</ScrollViewer> | ||
</Grid> | ||
|
||
|
||
<Grid HorizontalAlignment="Right"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto" SharedSizeGroup="Label"/> | ||
<ColumnDefinition Width="*"/> | ||
<ColumnDefinition Width="*"/> | ||
</Grid.ColumnDefinitions> | ||
<Button Grid.Column="0" Content="Review" | ||
Height="25" Margin="10,10,10,10" Width="75" x:Name="btnOK" TabIndex="1600" IsDefault="True" Click="OnOkClick" | ||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center" /> | ||
<Button Grid.Column="1" Content="Update" | ||
Height="25" Margin="10,10,10,10" Width="75" x:Name="btnUpdate" TabIndex="1600" Click="OnUpdateClick" | ||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center" IsEnabled="{Binding IsUpdateEnabled}"/> | ||
<Button Grid.Column="2" Content="Cancel" | ||
Height="25" Margin="10,10,10,10" Width="75" x:Name="btnCancel" TabIndex="1700" IsCancel="True" | ||
VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Click="OnCancelClick" /> | ||
</Grid> | ||
</StackPanel> | ||
</Window> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zeusongit I think you need to carefully examine if this code leaks. You never dispose this stream.