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

Edit Python Port Properties #13788

Merged
merged 17 commits into from
Mar 14, 2023
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
33 changes: 32 additions & 1 deletion src/DynamoCoreWpf/Controls/DynamoNodeButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Dynamo.UI;
using Dynamo.Utilities;
using Dynamo.ViewModels;
using Dynamo.Wpf.Utilities;

namespace Dynamo.Nodes
{
Expand All @@ -28,6 +29,17 @@ private DynamoViewModel DynamoViewModel
}
}

private Window Owner
{
get
{
var f = WpfUtilities.FindUpVisualTree<DynamoView>(this);
if (f != null) return f;

return null;
}
}

public DynamoNodeButton()
{
}
Expand All @@ -49,9 +61,28 @@ private void OnDynamoNodeButtonClick(object sender, RoutedEventArgs e)
//
if (null != this.model && (!string.IsNullOrEmpty(this.eventName)))
{
MessageBoxResult result = MessageBoxResult.None;

if (eventName.Equals("RemoveInPort"))
{
result = MessageBoxService.Show
(
Owner,
Dynamo.Wpf.Properties.Resources.MessageRemovePythonPort,
Dynamo.Wpf.Properties.Resources.RemovePythonPortWarningMessageBoxTitle,
MessageBoxButton.OKCancel,
MessageBoxImage.Information
);
}

if (result == MessageBoxResult.Cancel)
{
return;
}

var command = new DynamoModel.ModelEventCommand(model.GUID, eventName);
this.DynamoViewModel.ExecuteCommand(command);
}
}
}
}
}
19 changes: 16 additions & 3 deletions src/DynamoCoreWpf/Controls/InPortContextMenu.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="Dynamo.UI.Controls.InPortContextMenu"
<UserControl x:Class="Dynamo.UI.Controls.InPortContextMenu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand Down Expand Up @@ -100,7 +100,8 @@
Command="{Binding Path=UseLevelsCommand}"
CommandParameter="{Binding Path=IsChecked, RelativeSource={RelativeSource Self}}"
Content="{x:Static p:Resources.UseLevelPopupMenuItem}"
IsChecked="{Binding Path=UseLevels, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" />
IsChecked="{Binding Path=UseLevels, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding IsPythonNodePort, Converter={StaticResource InverseBoolToVisibilityCollapsedConverter}}" />

<!-- Keep List Structure -->
<CheckBox Name="KeepListStructure"
Expand All @@ -110,7 +111,8 @@
CommandParameter="{Binding Path=IsChecked, RelativeSource={RelativeSource Self}}"
Content="{x:Static p:Resources.UseLevelKeepListStructurePopupMenuItem}"
IsChecked="{Binding Path=ShouldKeepListStructure, Mode=OneWay}"
IsEnabled="{Binding ElementName=UseLevel, Path=IsChecked}" />
IsEnabled="{Binding ElementName=UseLevel, Path=IsChecked}"
Visibility="{Binding IsPythonNodePort, Converter={StaticResource InverseBoolToVisibilityCollapsedConverter}}" />

<!-- Use Default Value -->
<CheckBox Name="UseDefaultValue"
Expand All @@ -119,6 +121,17 @@
Content="{x:Static p:Resources.PortViewContextMenuUserDefaultValue}"
IsChecked="{Binding Path=UsingDefaultValue, Mode=TwoWay}"
Visibility="{Binding DefaultValueEnabled, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />

<!-- Rename Port -->
<Button Name="RenamePortButton"
Margin="0,3"
HorizontalAlignment="Left"
Command="{Binding Path=EditPortPropertiesCommand}"
Content="{x:Static p:Resources.RenamePortPopupMenuItem}"
IsEnabled="{Binding RenameNodeButtonEnabled, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding RenameNodeButtonEnabled, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
Style="{StaticResource PopupButtonStyle}" />

</StackPanel>
</Border>

Expand Down
12 changes: 11 additions & 1 deletion src/DynamoCoreWpf/Controls/OutPortContextMenu.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="Dynamo.UI.Controls.OutPortContextMenu"
<UserControl x:Class="Dynamo.UI.Controls.OutPortContextMenu"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand Down Expand Up @@ -48,6 +48,16 @@
IsEnabled="{Binding HideWiresButtonEnabled, UpdateSourceTrigger=PropertyChanged}"
Style="{StaticResource PopupButtonStyle}" />

<!-- Rename Port -->
<Button Name="RenamePortButton"
Margin="0,3"
HorizontalAlignment="Left"
Command="{Binding Path=EditPortPropertiesCommand}"
Content="{x:Static p:Resources.RenamePortPopupMenuItem}"
IsEnabled="{Binding RenameNodeButtonEnabled, UpdateSourceTrigger=PropertyChanged}"
Visibility="{Binding RenameNodeButtonEnabled, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
Style="{StaticResource PopupButtonStyle}" />

</StackPanel>
</Border>

Expand Down
4 changes: 2 additions & 2 deletions src/DynamoCoreWpf/Controls/OutPortContextMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using System;
using System;
using System.Windows;
using System.Windows.Controls;
using Dynamo.ViewModels;

namespace Dynamo.UI.Controls
{
/// <summary>
/// Interaction logic for InPortContextMenu.xaml
/// Interaction logic for OutPortContextMenu.xaml
/// </summary>
public partial class OutPortContextMenu : UserControl
{
Expand Down
3 changes: 3 additions & 0 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<None Remove="Packages\SplashScreen\build\index.bundle.js" />
<None Remove="Packages\SplashScreen\build\index.html" />
<None Remove="UI\Images\Canvas\canvas-button-geometry-scaling.png" />
<None Remove="UI\Prompts\PortPropertiesEditPrompt.xaml" />
<None Remove="Views\Core\CustomColorPicker.xaml" />
<None Remove="Views\Core\GeometryScalingPopup.xaml" />
<None Remove="UI\Images\question-hover-blue-16px.png" />
Expand Down Expand Up @@ -226,6 +227,7 @@
<Compile Include="Controls\InPortContextMenu.xaml.cs">
<DependentUpon>InPortContextMenu.xaml</DependentUpon>
</Compile>
<Compile Include="UI\Prompts\PortPropertiesEditPrompt.xaml.cs" />
<Compile Include="Utilities\CompactBubbleHandler.cs" />
<Compile Include="Interfaces\IShellCom.cs" />
<Compile Include="Rendering\HelixRenderPackage.cs" />
Expand Down Expand Up @@ -561,6 +563,7 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="UI\Prompts\PortPropertiesEditPrompt.xaml"></Page>
<Page Include="Views\Core\CustomColorPicker.xaml">
<CopyToOutputDirectory></CopyToOutputDirectory>
<Generator>MSBuild:Compile</Generator>
Expand Down
90 changes: 90 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.

36 changes: 36 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2575,6 +2575,9 @@ Do you wish to uninstall {1}? Restart {2} to complete the uninstall and try down
<data name="BreakConnectionsPopupMenuItem" xml:space="preserve">
<value>Break Connections</value>
</data>
<data name="RenamePortPopupMenuItem" xml:space="preserve">
<value>Edit Port Properties</value>
</data>
<data name="HideWiresPopupMenuItem" xml:space="preserve">
<value>Hide Wires</value>
</data>
Expand Down Expand Up @@ -3494,6 +3497,39 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="DynamoViewSettingLibraryZoomScale" xml:space="preserve">
<value>Library</value>
</data>
<data name="PortPropertiesPromptInputWindowTitle">
<value>Input Port Properties</value>
<comment>Input Port title</comment>
</data>
<data name="PortPropertiesPromptOutputWindowTitle">
<value>Output Port Properties</value>
<comment>Output Port title</comment>
</data>
<data name="PortPropertiesPromptDescriptionTooltip">
<value>Description of port</value>
<comment>Description of port</comment>
</data>
<data name="PortPropertiesPromptWindowDescription">
<value>Description</value>
<comment>Port Description Label</comment>
</data>
<data name="PortPropertiesPromptNameTooltip">
<value>Port name</value>
<comment>Name of port</comment>
</data>
<data name="PortPropertiesPromptWindowName">
<value>Name</value>
<comment>Port Name Label</comment>
</data>
<data name="RemovePythonPortWarningMessageBoxTitle" xml:space="preserve">
<value>Remove port?</value>
</data>
<data name="MessageRemovePythonPort" xml:space="preserve">
<value>Your custom port properties will be lost once the port is removed.</value>
</data>
<data name="MessagePortNameInvalid" xml:space="preserve">
<value>Cannot contain special characters (# % * ? \ : [ ])</value>
</data>
<data name="PreferencesViewEnablePersistExtensions" xml:space="preserve">
<value>On launch, remember open extensions panels from last session</value>
</data>
Expand Down
36 changes: 36 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2276,6 +2276,9 @@ Next assemblies were loaded several times:
<data name="BreakConnectionsPopupMenuItem" xml:space="preserve">
<value>Break Connections</value>
</data>
<data name="RenamePortPopupMenuItem" xml:space="preserve">
<value>Edit Port Properties</value>
</data>
<data name="HideWiresPopupMenuItem" xml:space="preserve">
<value>Hide Wires</value>
</data>
Expand Down Expand Up @@ -3481,6 +3484,39 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="DynamoViewSettingLibraryZoomScale" xml:space="preserve">
<value>Library</value>
</data>
<data name="PortPropertiesPromptInputWindowTitle">
<value>Input Port Properties</value>
<comment>Input Port title</comment>
</data>
<data name="PortPropertiesPromptOutputWindowTitle">
<value>Output Port Properties</value>
<comment>Output Port title</comment>
</data>
<data name="PortPropertiesPromptDescriptionTooltip">
<value>Description of port</value>
<comment>Description of port</comment>
</data>
<data name="PortPropertiesPromptWindowDescription">
<value>Description</value>
<comment>Port Description Label</comment>
</data>
<data name="PortPropertiesPromptNameTooltip">
<value>Port name</value>
<comment>Name of port</comment>
</data>
<data name="PortPropertiesPromptWindowName">
<value>Name</value>
<comment>Port Name Label</comment>
</data>
<data name="RemovePythonPortWarningMessageBoxTitle" xml:space="preserve">
<value>Remove port?</value>
</data>
<data name="MessageRemovePythonPort" xml:space="preserve">
<value>Your custom port properties will be lost once the port is removed.</value>
</data>
<data name="MessagePortNameInvalid" xml:space="preserve">
<value>Cannot contain special characters (# % * ? \ : [ ])</value>
</data>
<data name="PreferencesViewEnablePersistExtensions" xml:space="preserve">
<value>On launch, remember open extensions panels from last session</value>
</data>
Expand Down
Loading