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

WIP : Add a preference setting to hide icons #14968

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
5 changes: 5 additions & 0 deletions src/DynamoCore/Configuration/IPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
/// Return a list of GraphChecksumItems
/// </summary>
List<GraphChecksumItem> GraphChecksumItemsList { get; set; }

/// <summary>
/// Indicates if node icons should be displayed on nodes.
/// </summary>
bool ShowNodeIcons { get; set; }

Check failure on line 163 in src/DynamoCore/Configuration/IPreferences.cs

View workflow job for this annotation

GitHub Actions / analyze

Check failure on line 163 in src/DynamoCore/Configuration/IPreferences.cs

View workflow job for this annotation

GitHub Actions / analyze

}

/// <summary>
Expand Down
5 changes: 5 additions & 0 deletions src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@
/// Indicates if preview bubbles should be displayed on nodes.
/// </summary>
public bool ShowPreviewBubbles { get; set; }
/// <summary>
/// Indicates if node icons should be displayed on nodes.
/// </summary>
public bool ShowNodeIcons { get; set; }

Check failure on line 186 in src/DynamoCore/Configuration/PreferenceSettings.cs

View workflow job for this annotation

GitHub Actions / analyze

Check failure on line 186 in src/DynamoCore/Configuration/PreferenceSettings.cs

View workflow job for this annotation

GitHub Actions / analyze


/// <summary>
/// Indicates if Host units should be used for graphic helpers for Dynamo Revit
Expand Down Expand Up @@ -920,6 +924,7 @@
LibraryWidth = 304;
ConsoleHeight = 0;
ShowPreviewBubbles = true;
ShowNodeIcons = true;
ShowCodeBlockLineNumber = true;
ShowConnector = true;
ShowConnectorToolTip = true;
Expand Down
18 changes: 18 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

7 changes: 7 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3931,6 +3931,13 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<value>Enable Paneling nodes</value>
<comment>Preferences | Features | Experimental | Enable Paneling nodes</comment>
</data>
<data name="PreferencesViewShowNodeIcons" xml:space="preserve">
<value>Show Node Icons</value>
<comment>Preferences | Visual Settings | Display Settings | Show Node Icons</comment>
</data>
<data name="PreferencesWindowShowNodeIconsTooltip" xml:space="preserve">
<value>When toggled on, the node’s icons will be displayed on the top-left corner of the node.</value>
</data>
<data name="PreferencesSettingTemplateLocationLabel" xml:space="preserve">
<value>Templates Path</value>
</data>
Expand Down
7 changes: 7 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3918,6 +3918,13 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<value>Enable Paneling nodes</value>
<comment>Preferences | Features | Experimental | Enable Paneling nodes</comment>
</data>
<data name="PreferencesViewShowNodeIcons" xml:space="preserve">
<value>Show Node Icons</value>
<comment>Preferences | Visual Settings | Display Settings | Show Node Icons</comment>
</data>
<data name="PreferencesWindowShowNodeIconsTooltip" xml:space="preserve">
<value>When toggled on, the node’s icons will be displayed on the top-left corner of the node.</value>
</data>
<data name="PreferencesSettingTemplateLocationLabel" xml:space="preserve">
<value>Templates Path</value>
</data>
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 @@ -2417,6 +2417,7 @@
Dynamo.ViewModels.NodeViewModel.ShowExecutionPreview.get -> bool
Dynamo.ViewModels.NodeViewModel.ShowExecutionPreview.set -> void
Dynamo.ViewModels.NodeViewModel.ShowHelpCommand.get -> Dynamo.UI.Commands.DelegateCommand
Dynamo.ViewModels.NodeViewModel.ShowNodeIcons.get -> string

Check failure on line 2420 in src/DynamoCoreWpf/PublicAPI.Unshipped.txt

View workflow job for this annotation

GitHub Actions / analyze

Symbol 'Dynamo.ViewModels.NodeViewModel.ShowNodeIcons.get -> string' is part of the declared API, but is either not public or could not be found (https://github.com/dotnet/roslyn-analyzers/blob/main/src/PublicApiAnalyzers/PublicApiAnalyzers.Help.md)
Dynamo.ViewModels.NodeViewModel.ShowsVisibilityToggles.get -> bool
Dynamo.ViewModels.NodeViewModel.SnapInputEvent -> Dynamo.ViewModels.NodeViewModel.SnapInputEventHandler
Dynamo.ViewModels.NodeViewModel.SnapInputEventHandler
Expand Down Expand Up @@ -2745,6 +2746,8 @@
Dynamo.ViewModels.PreferencesViewModel.ShowCodeBlockLineNumber.set -> void
Dynamo.ViewModels.PreferencesViewModel.ShowEdges.get -> bool
Dynamo.ViewModels.PreferencesViewModel.ShowEdges.set -> void
Dynamo.ViewModels.PreferencesViewModel.ShowNodeIcons.get -> bool
Dynamo.ViewModels.PreferencesViewModel.ShowNodeIcons.set -> void
Dynamo.ViewModels.PreferencesViewModel.ShowPreviewBubbles.get -> bool
Dynamo.ViewModels.PreferencesViewModel.ShowPreviewBubbles.set -> void
Dynamo.ViewModels.PreferencesViewModel.ShowWhitespaceIsChecked.get -> bool
Expand Down
19 changes: 17 additions & 2 deletions src/DynamoCoreWpf/ViewModels/Core/NodeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,18 @@
}
}

/// <summary>
/// Returns if node icon should be displayed as per the preference settings or not.
/// </summary>
[JsonIgnore]
public bool ShowNodeIcons
{
get

Check failure on line 255 in src/DynamoCoreWpf/ViewModels/Core/NodeViewModel.cs

View workflow job for this annotation

GitHub Actions / analyze

{
return DynamoViewModel.Model.PreferenceSettings.ShowNodeIcons;
}
}

/// <summary>
/// If a node has been renamed. Notice this boolean will be disabled
/// (always false) if the node is dummy node or unloaded custom node.
Expand Down Expand Up @@ -885,9 +897,12 @@
ZIndex = ++StaticZIndex;
++NoteViewModel.StaticZIndex;

if (workspaceViewModel.InCanvasSearchViewModel != null && workspaceViewModel.InCanvasSearchViewModel.TryGetNodeIcon(this, out ImageSource imgSource))
if (DynamoViewModel.PreferenceSettings.ShowNodeIcons)
{
ImageSource = imgSource;
if (workspaceViewModel.InCanvasSearchViewModel != null && workspaceViewModel.InCanvasSearchViewModel.TryGetNodeIcon(this, out ImageSource imgSource))
{
ImageSource = imgSource;
}
}
logic.NodeMessagesClearing += Logic_NodeMessagesClearing;
logic.NodeInfoMessagesClearing += Logic_NodeInfoMessagesClearing;
Expand Down
19 changes: 19 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,22 @@ public bool ShowPreviewBubbles
}
}

/// <summary>
/// Indicates if node icons should be displayed on nodes.
/// </summary>
public bool ShowNodeIcons
{
get
{
return preferenceSettings.ShowNodeIcons;
}
set
{
preferenceSettings.ShowNodeIcons = value;
RaisePropertyChanged(nameof(ShowNodeIcons));
}
}

/// <summary>
/// Indicates if Host units should be used for graphic helpers for Dynamo Revit
/// Also toggles between Host and Dynamo units
Expand Down Expand Up @@ -1807,6 +1823,9 @@ private void Model_PropertyChanged(object sender, PropertyChangedEventArgs e)
case nameof(ShowPreviewBubbles):
description = Res.ResourceManager.GetString(nameof(Res.PreferencesViewShowPreviewBubbles), System.Globalization.CultureInfo.InvariantCulture);
goto default;
case nameof(ShowNodeIcons):
description = Res.ResourceManager.GetString(nameof(Res.PreferencesViewShowNodeIcons), System.Globalization.CultureInfo.InvariantCulture);
goto default;
case nameof(ShowCodeBlockLineNumber):
description = Res.ResourceManager.GetString(nameof(Res.PreferencesViewShowCodeBlockNodeLineNumber), System.Globalization.CultureInfo.InvariantCulture);
goto default;
Expand Down
3 changes: 2 additions & 1 deletion src/DynamoCoreWpf/Views/Core/NodeView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@
<!-- The Icon for this Node -->
<Rectangle Name="nodeIcon"
Width="34"
Height="34">
Height="34"
Visibility="{Binding ShowNodeIcons, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" >
<Rectangle.Style>
<Style TargetType="Rectangle">
<Setter Property="Fill">
Expand Down
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/Views/Core/NodeView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ private bool IsPreviewDisabled()
// Or preview shouldn't be shown for some nodes (e.g. number sliders, watch nodes etc.)
// Or node is frozen.
return !ViewModel.DynamoViewModel.ShowPreviewBubbles ||
!ViewModel.DynamoViewModel.PreferenceSettings.ShowPreviewBubbles ||
ViewModel.WorkspaceViewModel.IsConnecting ||
ViewModel.WorkspaceViewModel.IsSelecting || !previewEnabled ||
!ViewModel.IsPreviewInsetVisible || ViewModel.IsFrozen;
Expand Down
39 changes: 37 additions & 2 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1348,6 +1348,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>

<StackPanel Orientation="Horizontal"
Expand Down Expand Up @@ -1519,10 +1520,44 @@
</Image>
</Label>
</StackPanel>


<StackPanel Orientation="Horizontal"
Margin="0,12,0,0"
Grid.Row="5">
<ToggleButton Name="ShowNodeIconsToggle"
Width="{StaticResource ToggleButtonWidth}"
Height="{StaticResource ToggleButtonHeight}"
VerticalAlignment="Center"
IsChecked="{Binding Path=ShowNodeIcons}"
Style="{StaticResource EllipseToggleButton1}"/>
<Label Content="{x:Static p:Resources.PreferencesViewShowNodeIcons}"
VerticalAlignment="Center"
Margin="10,0,0,0"
Foreground="{StaticResource PreferencesWindowFontColor}"/>
<Label HorizontalAlignment="Left"
Name="ShowNodeIconsInfoLabel"
VerticalAlignment="Center"
Height="26"
Width="53"
Margin="0 3 0 0">
<Image
Margin="5,3,0,0"
Width="14"
Height="14"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource QuestionIcon}"
ToolTipService.ShowDuration="30000">
<Image.ToolTip>
<ToolTip Content="{x:Static p:Resources.PreferencesWindowShowNodeIconsTooltip}" Style="{StaticResource GenericToolTipLight}"/>
</Image.ToolTip>
</Image>
</Label>
</StackPanel>

<Grid x:Name="GraphicHelpersScale"
Margin="0 12 0 5"
Grid.Row="5">
Grid.Row="6">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
Expand Down
Loading