Skip to content

Commit

Permalink
Multiple cherrypicks to 2.17.1 (#13727)
Browse files Browse the repository at this point in the history
* Dyn 5347 unified UI information icons (#13706)

* standardizing information icons in the preference settings

* Defending code (#13696)

* Defending code

* refining code

* Improve Package Manager search sort order (#13700)

* add search sort order

* Add option to preview or hide preview of all geometry in a group and Fix top menu pixel difference (#13702)

* Adjust border to fix 1 pixel anomaly

* remove unused login grid

* add logic to toggle preview for group

* add analytics

* Preview > Preview Geometry

* ensure that signout option no seen when user sign out

* DYN-4964-WorkingRange-Popup (#13656)

* DYN-4964-WorkingRange-Popup

I've added a new button in the Workspace that when is clicked will show a popup containing the working ranges and the one currently selected.
This new button will show a different image when the mouse is hover and when is clicked, also I've added a tooltip.
For implementing this functionality I've added a new Popup (GeometryScalingPopup.xaml) and it's corresponding ViewModel. Finally I've added a converter that will receive as a parameter the current Working Range and will return a Brush with a specific color so the checkmark will be visible or not.

* DYN-4964-WorkingRange-Popup CodeReview1

Added functionality for the new DefaultGeometryScaling property that will be serialized in the DynamoSettings.xml.
Also I've disconnected the functionality of selecting the Geometry Scale for the current Workspace in the Preferences panel, now will be selected from the Dynamo workspace and will be serialized in the dyn file (as currently is happening).

* DYN-4964-WorkingRange-Popup CodeReview1

Updated the string shown in Preferences panel (Geometry Scaling section) and the tooltip showed when the mouse is over the new Workspace button.

* Build Fix

When merging master to my branch there were some changed that I didn't noticed in the PR so I'm reverting back those changes.

* DYN-4964-WorkingRange-Popup CodeReview 2

Fixed several comments also several methods were removed (like RadioGeometryScaling_Checked method) or moved
The property GeoScalingViewModel was moved from DynamoViewModel to WorkspaceViewModel..
The property CurrentGeometryScaling was deleted due that was duplicating a functionality.

* DYN-4964-WorkingRange-Popup CodeReview 2

When changing the Workspace Geometry Scaling it was not running the graph so I did some changes so it will be running the graph every time is updated.

* DYN-4964-WorkingRange-Popup CodeReview 2

Add functionality for when a custom node is created the Workspace Scale Factor is set.
Updating and removing some comments and also I started to add the unit test.

* DYN-4964-WorkingRange-Popup CodeReview2

Updating Unit Test

* DYN-4964-WorkingRange-Popup Fixing Tests

I did the next fixes:
The test TestImportCopySettings() was failing due that was reading the DynamoSettings-NewSettings.xml and comparing against the properties in PreferencesSetting so the DefaultScaleFactor was missing in the DynamoSettings-NewSettings.xml file.

The test PreferencesGeoScaling_RunGraph_Automatic due that was opening the Preferences panel and changing the Geometry Scaling value for the workspace but now that this value was moved to the Workspace in a Popup then the code needed some changes so we can change the Geometry Scaling value using the Popup.

* Dyn 4964 popup geo scaling bugs (#13717)

* DYN-4964-PopupGeoScaling-Bugs

Fixing the next bugs reported by Aabi:
- The Popup was not closing when clicking in the Dynamo workspace (adding a similar fix like the Workspace ContextMenu).
- Adding a shadow over the new Geometry Scaling popup icon.

* DYN-4964-WorkingRange-Popup Bug fixes

There was a missing case that when the user click a Dynamo menu the Popup was not closing then I added some extra code to close it.

* DYN-4964-WorkingRange-Popup Bug Code Review1

Removing extra trailing spaces.

* Do not force user login for package search operation (#13725)

* restrict user login for pkg search

* check login state

* Revert "Dyn 4964 popup geo scaling bugs (#13717)"

This reverts commit 35005c3.

* Revert "DYN-4964-WorkingRange-Popup (#13656)"

This reverts commit a526390.

* Markdown procedural image location (#13693)

* Markdown procedural image location

- fixed hard-coded image location
- now identifies image location

* Fixed Failing Tests

- caught a bug causing issues when no image is present

* Revert "Markdown procedural image location (#13693)"

This reverts commit 299bbe9.

* Address review comments for 2.17.1 cherrypick PR (#13729)

---------

Co-authored-by: filipeotero <[email protected]>
Co-authored-by: jesusalvino <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2023
1 parent c0b0771 commit dc8d57d
Show file tree
Hide file tree
Showing 17 changed files with 322 additions and 124 deletions.
20 changes: 20 additions & 0 deletions src/DynamoCore/Graph/Annotations/AnnotationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,26 @@ internal set
/// </summary>
public bool HasNestedGroups => nodes.OfType<AnnotationModel>().Any();

private bool isVisible = true;
/// <summary>
/// Preview visibility of the nodes in a group
/// </summary>
[JsonIgnore]
public bool IsVisible
{
get
{
return isVisible;
}
internal set
{
if (value != isVisible)
{
isVisible = value;
RaisePropertyChanged(nameof(IsVisible));
}
}
}
#endregion

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ public ShortcutToolbar(DynamoViewModel dynamoViewModel)
var shortcutToolbar = new ShortcutToolbarViewModel(dynamoViewModel);
DataContext = shortcutToolbar;
authManager = dynamoViewModel.Model.AuthenticationManager;
if (authManager.IsLoggedIn()) {
if (authManager.IsLoggedIn())
{
authManager.LoginStateChanged += SignOutHandler;
}
else {
logoutOption.Visibility = Visibility.Collapsed;
}
}

private void SignOutHandler(LoginState status)
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/Controls/StartPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</Grid.RowDefinitions>

<!-- Begin top part (i.e. the "Start" tab) -->
<Border HorizontalAlignment="Stretch" Background="#3C3C3C" Margin="220,-40,0,49"></Border>
<Border HorizontalAlignment="Stretch" Background="#3C3C3C" Margin="220,-40,0,50"></Border>

<!-- Begin Dynamo logo -->
<Image Name="StartPageLogo"
Expand Down
4 changes: 4 additions & 0 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<ItemGroup>
<None Remove="node_modules\%40dynamods\splash-screen\build\index.bundle.js" />
<None Remove="node_modules\%40dynamods\splash-screen\build\index.html" />
<None Remove="UI\Images\question-hover-blue-16px.png" />
<None Remove="Views\SplashScreen\WebApp\splashScreenBackground.png" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -70,6 +71,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DynamoVisualProgramming.LibG_229_0_0" Version="2.17.1.3967"/>
<PackageReference Include="DynamoVisualProgramming.LibG_229_0_0" Version="2.16.0.3736" />
<PackageReference Include="AvalonEdit" Version="4.3.1.9430" CopyXML="true" />
<PackageReference Include="Greg" Version="2.3.0.2505" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
Expand Down Expand Up @@ -824,6 +827,7 @@
<Resource Include="UI\Images\NodeStates\frozen-64px.png" />
<Resource Include="UI\Images\NodeStates\hidden-64px.png" />
<Resource Include="UI\Images\NodeStates\info-64px.png" />
<Resource Include="UI\Images\question-hover-blue-16px.png" />
<Resource Include="UI\Images\TitleBarButtons\close-darktheme-default-16px.png" />
<Resource Include="UI\Images\TitleBarButtons\close-lighttheme-default-16px.png" />
<Resource Include="UI\Images\TitleBarButtons\close-lighttheme-hover-16px.png" />
Expand Down
13 changes: 11 additions & 2 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

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

5 changes: 4 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ To avoid unintended behavior, uninstall the conflicting loaded package(s), resta
<value>Is Output</value>
</data>
<data name="NodeContextMenuPreview" xml:space="preserve">
<value>Preview</value>
<value>Preview Geometry</value>
<comment>Context menu item - preview geometry</comment>
</data>
<data name="NodeContextMenuRenameNode" xml:space="preserve">
Expand Down Expand Up @@ -3482,4 +3482,7 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="SplashScreenSigningIn" xml:space="preserve">
<value>Signing In</value>
</data>
<data name="GroupContextMenuPreview" xml:space="preserve">
<value>Preview Geometry</value>
</data>
</root>
5 changes: 4 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@
<comment>Lacing strategy: use the shortest list</comment>
</data>
<data name="NodeContextMenuPreview" xml:space="preserve">
<value>Preview</value>
<value>Preview Geometry</value>
<comment>Context menu item - preview geometry</comment>
</data>
<data name="NodeContextMenuRenameNode" xml:space="preserve">
Expand Down Expand Up @@ -3469,4 +3469,7 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="SplashScreenSigningIn" xml:space="preserve">
<value>Signing In</value>
</data>
<data name="GroupContextMenuPreview" xml:space="preserve">
<value>Preview Geometry</value>
</data>
</root>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5460,6 +5460,18 @@
</Trigger>
</Style.Triggers>
</Style>

<!-- Common Question Clickable Icon -->
<Style x:Key="QuestionIconClickable" TargetType="{x:Type Image}">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Source" Value="pack://application:,,,/DynamoCoreWpf;component/UI/Images/question-default-16px.png" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Source" Value="pack://application:,,,/DynamoCoreWpf;component/UI/Images/question-hover-blue-16px.png" />
</Trigger>
</Style.Triggers>
</Style>

<!-- Common Question Icon -->
<Style x:Key="QuestionIcon" TargetType="{x:Type Image}">
Expand Down
37 changes: 29 additions & 8 deletions src/DynamoCoreWpf/ViewModels/Core/AnnotationViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,12 @@ private bool CanChangeFontSize(object obj)
{
return true;
}

/// <summary>
/// Command to toggle this group's node preview visibility.
/// </summary>
[JsonIgnore]
public DelegateCommand ToggleIsVisibleGroupCommand { get; private set; }
#endregion

public AnnotationViewModel(WorkspaceViewModel workspaceViewModel, AnnotationModel model)
Expand All @@ -625,6 +631,7 @@ public AnnotationViewModel(WorkspaceViewModel workspaceViewModel, AnnotationMode
model.PropertyChanged += model_PropertyChanged;
model.RemovedFromGroup += OnModelRemovedFromGroup;
model.AddedToGroup += OnModelAddedToGroup;
ToggleIsVisibleGroupCommand = new DelegateCommand(ToggleIsVisibleGroup, CanToggleIsVisibleGroup);

DynamoSelection.Instance.Selection.CollectionChanged += SelectionOnCollectionChanged;

Expand Down Expand Up @@ -664,7 +671,7 @@ public AnnotationViewModel(WorkspaceViewModel workspaceViewModel, AnnotationMode
groupStyleList = new ObservableCollection<Configuration.StyleItem>();
//This will add the GroupStyles created in Preferences panel to the Group Style Context menu.
LoadGroupStylesFromPreferences(preferenceSettings.GroupStyleItemsList);
}
}


/// <summary>
Expand Down Expand Up @@ -795,13 +802,6 @@ internal IEnumerable<PortModel> GetGroupOutPorts(IEnumerable<NodeModel> ownerNod
);
}

private double GetPortVerticalOffset(PortModel portModel, int proxyPortIndex)
{
// calculate the vertical offset based on the port index.
double portHeight = portModel.Height;
return verticalOffset + (proxyPortIndex * portHeight) + portVerticalMidPoint;
}

private Point2D CalculatePortPosition(PortModel portModel, double verticalPosition)
{
double groupHeaderHeight = Height - ModelAreaRect.Height;
Expand Down Expand Up @@ -1348,6 +1348,27 @@ private bool BelongsToGroup()
return WorkspaceViewModel.Model.Annotations.ContainsModel(this.annotationModel);
}

internal void ToggleIsVisibleGroup(object parameters)
{
DynamoSelection.Instance.ClearSelection();
var nodesInGroup = this.AnnotationModel.Nodes.Select(n => n.GUID).ToList();

var command = new DynamoModel.UpdateModelValueCommand(Guid.Empty,
nodesInGroup, nameof(this.AnnotationModel.IsVisible), (!this.AnnotationModel.IsVisible).ToString());

this.AnnotationModel.IsVisible = !this.AnnotationModel.IsVisible;
WorkspaceViewModel.DynamoViewModel.Model.ExecuteCommand(command);
WorkspaceViewModel.DynamoViewModel.RaiseCanExecuteUndoRedo();
WorkspaceViewModel.HasUnsavedChanges = true;

Analytics.TrackEvent(Actions.Preview, Categories.GroupOperations, this.AnnotationModel.IsVisible.ToString());
}

internal bool CanToggleIsVisibleGroup(object parameters)
{
return true;
}

public override void Dispose()
{
annotationModel.PropertyChanged -= model_PropertyChanged;
Expand Down
2 changes: 0 additions & 2 deletions src/DynamoCoreWpf/ViewModels/Core/ShortcutToolbarViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using Dynamo.Core;
using Dynamo.UI.Commands;
using Dynamo.UI.Controls;
using Dynamo.ViewModels;
using System.Windows;

namespace Dynamo.Wpf.ViewModels.Core
{
Expand Down
Loading

0 comments on commit dc8d57d

Please sign in to comment.