Skip to content

Commit

Permalink
Merge branch 'DYN-5106-WebView2-DocumentationBrowser' of https://gith…
Browse files Browse the repository at this point in the history
…ub.com/RobertGlobant20/Dynamo into DYN-5106-WebView2-DocumentationBrowser
  • Loading branch information
RobertGlobant20 committed Aug 15, 2022
2 parents dc993a0 + fc26f34 commit ab4326d
Show file tree
Hide file tree
Showing 13 changed files with 333 additions and 21 deletions.
16 changes: 15 additions & 1 deletion src/DynamoCoreWpf/UI/Themes/Modern/OutPorts.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,21 @@
IsHitTestVisible="True">
<Grid.ColumnDefinitions>
<ColumnDefinition Name="PortNameColumn" Width="*" />
<ColumnDefinition Name="ValueMarkerColumn" Width="5px" />
<ColumnDefinition Name="ValueMarkerColumn">
<ColumnDefinition.Style>
<Style TargetType="ColumnDefinition">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=PortDefaultValueMarkerVisible}" Value="True">
<Setter Property="Width" Value="5px" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=PortDefaultValueMarkerVisible}" Value="False">
<Setter Property="Width" Value="0px" />
</DataTrigger>
</Style.Triggers>
</Style>
</ColumnDefinition.Style>
</ColumnDefinition>

<ColumnDefinition Name="PortSnappingColumn" Width="25px" />
</Grid.ColumnDefinitions>

Expand Down
4 changes: 2 additions & 2 deletions src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ public int CurrentWorkspaceIndex

// Keep DynamoModel.CurrentWorkspace update-to-date
int modelIndex = model.Workspaces.IndexOf(currentWorkspaceViewModel.Model);
ExecuteCommand(new DynamoModel.SwitchTabCommand(modelIndex));
(HomeSpaceViewModel as HomeWorkspaceViewModel).UpdateRunStatusMsgBasedOnStates();
ExecuteCommand(new DynamoModel.SwitchTabCommand(modelIndex));
(HomeSpaceViewModel as HomeWorkspaceViewModel)?.UpdateRunStatusMsgBasedOnStates();
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Core/OutPortViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ public partial class OutPortViewModel : PortViewModel
private SolidColorBrush portValueMarkerColor = new SolidColorBrush(Color.FromArgb(255, 204, 204, 204));

internal static SolidColorBrush PortValueMarkerGrey = new SolidColorBrush(Color.FromRgb(153, 153, 153));
internal static int valueMarkerWidthWithFunction = 5;
internal static int valueMarkerWidthWithoutFunction = 0;

private bool showContextMenu;
private bool areConnectorsHidden;
private string showHideWiresButtonContent = "";
private bool hideWiresButtonEnabled;
private bool portDefaultValueMarkerVisible;
private int valueMarkerWidth;

/// <summary>
/// Sets the condensed styling on Code Block output ports.
Expand Down Expand Up @@ -130,6 +133,29 @@ public bool PortDefaultValueMarkerVisible
}
}

/// <summary>
/// Returns the width from the ValueMarkerColumn
/// </summary>
public int ValueMarkerWidth
{
get => valueMarkerWidth;
}

/// <summary>
/// Returns the width to assign to the ValueMarkerColumn when is function state
/// </summary>
public int ValueMarkerWidthWithFunction
{
get => valueMarkerWidthWithFunction;
}

/// <summary>
/// Returns the width to assign to the ValueMarkerColumn when is not function state
/// </summary>
public int ValueMarkerWidthWithoutFunction
{
get => valueMarkerWidthWithoutFunction;
}

/// <summary>
/// Takes care of the multiple UI concerns when dealing with the Unhide/Hide Wires button
Expand Down Expand Up @@ -310,6 +336,7 @@ private void OnMouseLeftButtonDownOnContext(object parameter)
protected override void RefreshPortColors()
{
PortDefaultValueMarkerVisible = node.NodeModel.CachedValue != null && node.NodeModel.CachedValue.IsFunction && !node.IsWatchNode;
valueMarkerWidth = PortDefaultValueMarkerVisible ? valueMarkerWidthWithFunction : valueMarkerWidthWithoutFunction;
}
}
}
4 changes: 2 additions & 2 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2507,8 +2507,8 @@ private void FileTrustWarning_Click(object sender, RoutedEventArgs e)
}

private void DynamoView_Activated(object sender, EventArgs e)
{
if (fileTrustWarningPopup != null)
{
if (fileTrustWarningPopup != null && dynamoViewModel.ViewingHomespace)
{
fileTrustWarningPopup.ManagePopupActivation(true);
}
Expand Down
11 changes: 9 additions & 2 deletions src/DynamoCoreWpf/Views/FileTrust/FileTrustWarning.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,16 @@ public FileTrustWarning(DynamoView dynamoViewWindow)

private void DynViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "CurrentSpace" && !dynViewModel.ViewingHomespace)
if (e.PropertyName == nameof(DynamoViewModel.CurrentSpace))
{
IsOpen = false;
if (dynViewModel.ViewingHomespace)
{
ManagePopupActivation(true);
}
else
{
IsOpen = false;
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/Libraries/CoreNodeModelsWpf/Controls/ColorPalette.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
Width="80"
AvailableColorsHeader="{x:Static p:CoreNodeModelWpfResources.ColorPaletteUIStandardColors}"
ShowStandardColors="False"
ShowRecentColors="True"
ShowRecentColors="True"
StandardButtonHeader="{x:Static p:CoreNodeModelWpfResources.ColorPaletteUIStandardButtonHeader}"
AdvancedButtonHeader="{x:Static p:CoreNodeModelWpfResources.ColorPaletteUIAdvancedButtonHeader}"
RecentColorsHeader="{x:Static p:CoreNodeModelWpfResources.ColorPaletteUIRecentColors}" />
</Grid>
</UserControl>
20 changes: 10 additions & 10 deletions src/Libraries/CoreNodeModelsWpf/CoreNodeModelsWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@
</Page>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<Compile Update="Properties\CoreNodeModelWpfResources.Designer.cs">
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\Resources.en-US.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>CoreNodeModelWpfResources.resx</DependentUpon>
</Compile>
<Compile Update="Properties\CoreNodeModelWpfResources.en-US.Designer.cs">
<DesignTime>True</DesignTime>
<DependentUpon>Resources.en-US.resx</DependentUpon>
<AutoGen>True</AutoGen>
<DependentUpon>CoreNodeModelWpfResources.en-US.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
Expand All @@ -110,13 +110,13 @@
<Resource Include="Resources\MissingNode.png" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<EmbeddedResource Update="Properties\CoreNodeModelWpfResources.en-US.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<LastGenOutput>CoreNodeModelWpfResources.en-US.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="Properties\Resources.en-US.resx">
<EmbeddedResource Update="Properties\CoreNodeModelWpfResources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.en-US.Designer.cs</LastGenOutput>
<LastGenOutput>CoreNodeModelWpfResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<Target Name="BinaryCompatibilityOps" BeforeTargets="Build">
Expand Down

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
Expand Up @@ -117,9 +117,15 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ColorPaletteUIAdvancedButtonHeader" xml:space="preserve">
<value>Advanced</value>
</data>
<data name="ColorPaletteUIRecentColors" xml:space="preserve">
<value>Recent Colors</value>
</data>
<data name="ColorPaletteUIStandardButtonHeader" xml:space="preserve">
<value>Standard</value>
</data>
<data name="ColorPaletteUIStandardColors" xml:space="preserve">
<value>Standard Colors</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,15 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ColorPaletteUIAdvancedButtonHeader" xml:space="preserve">
<value>Advanced</value>
</data>
<data name="ColorPaletteUIRecentColors" xml:space="preserve">
<value>Recent Colors</value>
</data>
<data name="ColorPaletteUIStandardButtonHeader" xml:space="preserve">
<value>Standard</value>
</data>
<data name="ColorPaletteUIStandardColors" xml:space="preserve">
<value>Standard Colors</value>
</data>
Expand Down
4 changes: 2 additions & 2 deletions src/Notifications/Notifications.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<Target Name="NpmRunBuild" BeforeTargets="BeforeBuild">
<Exec Command="npm install @dynamods/notifications-center@latest" />
<Exec Command="npm install --prefix ./ @dynamods/notifications-center@latest" />
</Target>

<ItemGroup>
Expand Down Expand Up @@ -95,4 +95,4 @@
</ItemGroup>
<Copy SourceFiles="@(ExtensionDefinition)" DestinationFolder="$(OutputPath)\viewExtensions\" />
</Target>
</Project>
</Project>
21 changes: 20 additions & 1 deletion test/DynamoCoreWpfTests/NodeViewTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public class NodeViewTests : DynamoTestUIBase

protected override void GetLibrariesToPreload(List<string> libraries)
{
libraries.Add("FunctionObject.ds");
libraries.Add("FunctionObject.ds");
libraries.Add("DesignScriptBuiltin.dll");
libraries.Add("BuiltIn.ds");
libraries.Add("DSCPython.dll");
libraries.Add("FFITarget.dll");
Expand Down Expand Up @@ -587,5 +588,23 @@ public void TestPortColors_NodeModel()
Assert.AreEqual(InPortViewModel.PortValueMarkerRed.Color, (dportVMs[0] as InPortViewModel).PortValueMarkerColor.Color);
Assert.True((doutPorts[0] as OutPortViewModel).PortDefaultValueMarkerVisible);
}

[Test]
public void TestPortDefaultValueMarket_Visibility()
{
Open(@"UI\outport_valuemarker_portDefaultValueMarkerVisible.dyn");

var nodeWithFunction = NodeViewWithGuid("e3269c4b-2bab-43d0-b362-f0a589cbe02d");
var nodeWithOutFunction = NodeViewWithGuid("43985007-e995-494f-b3e7-7c5d6ba317c3");

var outPorts_Function = nodeWithFunction.ViewModel.OutPorts;
var outPorts_WithoutFunction = nodeWithOutFunction.ViewModel.OutPorts;

OutPortViewModel outPort_With_Function = outPorts_Function[0] as OutPortViewModel;
OutPortViewModel outPort_Without_Function = outPorts_WithoutFunction[0] as OutPortViewModel;

Assert.AreEqual(outPort_With_Function.ValueMarkerWidth, outPort_With_Function.ValueMarkerWidthWithFunction);
Assert.AreEqual(outPort_Without_Function.ValueMarkerWidth, outPort_Without_Function.ValueMarkerWidthWithoutFunction);
}
}
}
Loading

0 comments on commit ab4326d

Please sign in to comment.