Skip to content

Commit

Permalink
Dyn 3513 preferences modal dialog (#11534)
Browse files Browse the repository at this point in the history
* Revert "First version with migration from packages.config to package reference (#11186)"

This reverts commit c7a5e49.

* Revert "Revert "First version with migration from packages.config to package reference (#11186)""

This reverts commit 5906c99.

* Issues Type Predicter GitHub Action

I added a new workflow (issue_type_predicte.yaml) that is using the ML.NET model for predicting the issue type (source repo), so If a new issue is created in the Dynamo repo this workflow will run and will predict if is a Wishlist issue or not. If is a Wishlist issue it will be labeled as "Wishlist" and then another workflow will move the issue to the DynamoWishlist repo. If the issue is incomplete or is not valid the label "NotMLEvaluated" will be added to the issue.

Also I added two scripts more, one will return the issue body in a json string and the other one will clan the issue body removing sections not used like "Dynamo Version" or "Stack Trace"

* Fix for the GitHub token

When testing the issue predicter workflow the issues labeled as Wishlist were not moved to the DynamoWishlist repo due that the "Move Issue by labels" workflow failed. There was a problem with the PAT used to label the issue, I was using the wrong one (no triggers actions).

* DYN-3513 - new modal dialog for preferences

I added a new View(xaml) for the Preferences window also I added several entries in the Resources so they can be used in the PreferencesView.xaml. This changes only will satisfy the next requirements:
- The modal dialog should come with Preferences Title
- The modal dialog should come with Save Changes button
- The modal dialog should come with split lines
- Dynamo will be blocked until user exit that dialog

* DYN-3513 - new modal dialog for preferences

Updated the TabControl and TabItem because the Background property was set incorrectly in some places.

* DYN-3513 - updating branch with latest code in master

When merging the master branch (after updating my forked repo), i got several conflics in the Resources file, then I had to re-add the resources.
In the DynamoView I added the necessary code to launch the Preferences window when the user click the option in the Dynamo menu.
Finally I did some minor changes in the Preferences view.

* DYN-3513 - Fixing the drag & drop

In the title bar the drag & drop was not working correctly so I increased the width of the TextBlock.

* Removing changes in Assembly file

Removing changes in Assembly file

* DYN-3513 - Fixing code review comments

Based on the code review comments:
I moved the styles to the DynamoModern.xml
I added several comments in the PreferencesView.xaml

* DYN-3513 - Fixing code review comments

I removed one line in the csproj file because is not needed.
  • Loading branch information
RobertGlobant20 authored Mar 8, 2021
1 parent 42595c0 commit b9416cc
Show file tree
Hide file tree
Showing 9 changed files with 428 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@
</Compile>
<Compile Include="ViewModels\Watch3D\AttachedProperties.cs" />
<Compile Include="ViewModels\Watch3D\DynamoEffectsManager.cs" />
<Compile Include="Views\Menu\PreferencesView.xaml.cs">
<DependentUpon>PreferencesView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\Preview\CameraExtensions.cs" />
<Compile Include="Views\Preview\PreviewCompactView.xaml.cs">
<DependentUpon>PreviewCompactView.xaml</DependentUpon>
Expand Down Expand Up @@ -436,6 +439,10 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Views\Menu\PreferencesView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Windows\ExtensionWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down
36 changes: 36 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.

12 changes: 12 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2297,4 +2297,16 @@ Uninstall the following packages: {0}?</value>
<value>_Export</value>
<comment>File menu | Export</comment>
</data>
<data name="PreferencesViewFeaturesTab" xml:space="preserve">
<value>Features</value>
</data>
<data name="PreferencesViewGeneralTab" xml:space="preserve">
<value>General</value>
</data>
<data name="PreferencesViewTitle" xml:space="preserve">
<value>Preferences</value>
</data>
<data name="PreferencesViewVisualSettingsTab" xml:space="preserve">
<value>Visual Settings</value>
</data>
</root>
12 changes: 12 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2299,4 +2299,16 @@ Uninstall the following packages: {0}?</value>
<value>_Export</value>
<comment>File menu | Export</comment>
</data>
<data name="PreferencesViewFeaturesTab" xml:space="preserve">
<value>Features</value>
</data>
<data name="PreferencesViewGeneralTab" xml:space="preserve">
<value>General</value>
</data>
<data name="PreferencesViewTitle" xml:space="preserve">
<value>Preferences</value>
</data>
<data name="PreferencesViewVisualSettingsTab" xml:space="preserve">
<value>Visual Settings</value>
</data>
</root>
186 changes: 186 additions & 0 deletions src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2263,5 +2263,191 @@
</Setter.Value>
</Setter>
</Style>

<SolidColorBrush x:Key="PreferencesWindowBackgroundColor"
Color="#535353" />
<SolidColorBrush x:Key="PreferencesWindowFontColor"
Color="#E5E5E5" />
<SolidColorBrush x:Key="PreferencesWindowButtonColor"
Color="#0696D7" />
<SolidColorBrush x:Key="PreferencesWindowButtonPressedColor"
Color="#0778B0" />
<SolidColorBrush x:Key="PreferencesWindowButtonMouseOverFontColor"
Color="#CDCBCB" />
<SolidColorBrush x:Key="CloseButtonMouseOverBackground"
Color="#E81123" />
<SolidColorBrush x:Key="CloseButtonPressed"
Color="#B70F1B" />
<SolidColorBrush x:Key="CloseButtonMouseOverForeground"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TabItemUnSelected"
Color="DarkGray" />

<Style x:Key="CaptionButtonStyleClose"
TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="LayoutRoot"
Background="Transparent"
Width="46"
Height="40">
<TextBlock x:Name="txt"
Text="{TemplateBinding Content}"
FontFamily="Segoe MDL2 Assets"
FontSize="14"
Foreground="{StaticResource PreferencesWindowFontColor}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
RenderOptions.ClearTypeHint="Auto"
TextOptions.TextRenderingMode="Aliased"
TextOptions.TextFormattingMode="Display"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver"
Value="True">
<Setter TargetName="LayoutRoot"
Property="Background"
Value="{StaticResource CloseButtonMouseOverBackground}"/>
<Setter TargetName="txt"
Property="Foreground"
Value="{StaticResource CloseButtonMouseOverForeground}"/>
</Trigger>
<Trigger Property="IsPressed"
Value="True">
<Setter TargetName="LayoutRoot"
Property="Background"
Value="{StaticResource CloseButtonPressed}"/>
<Setter TargetName="txt"
Property="Foreground"
Value="{StaticResource CloseButtonMouseOverForeground}"/>
<Setter TargetName="txt"
Property="FontSize"
Value="12"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="CloseButtonStyle"
TargetType="Button"
BasedOn="{StaticResource CaptionButtonStyleClose}">
<Setter Property="Content"
Value="&#xE8BB;"/>
</Style>

<Style x:Key="NormalButtonStyle"
TargetType="Button">
<Setter Property="Foreground"
Value="{StaticResource PreferencesWindowFontColor}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Name="border"
Background="{StaticResource PreferencesWindowButtonColor}"
BorderThickness="1"
Padding="4,2"
BorderBrush="Transparent"
CornerRadius="3">
<Grid >
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center"
Name="contentShadow">
</ContentPresenter>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed"
Value="True">
<Setter TargetName="border"
Property="Background"
Value="{StaticResource PreferencesWindowButtonPressedColor}" />
<Setter Property="FontSize"
Value="11"/>
</Trigger>
<Trigger Property="IsMouseOver"
Value="True">
<Setter TargetName="border"
Property="Background"
Value="{StaticResource PreferencesWindowButtonPressedColor}" />
<Setter Property="Foreground"
Value="{StaticResource PreferencesWindowButtonMouseOverFontColor}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate >
</Setter.Value>
</Setter>
</Style>

<Style x:Key="LeftTab"
TargetType="{x:Type TabItem}">
<Setter Property="HorizontalAlignment"
Value="Left"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabItem}">
<Border Margin="2"
Name="TabBorder"
CornerRadius="6"
BorderBrush="Transparent"
Background="Transparent"
BorderThickness="2"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<StackPanel Orientation="Horizontal"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch">
<Grid Name="TabPanel"
Width="100"
Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label x:Name="SelectedItem"
Grid.Column="0"/>
<ContentPresenter x:Name="ContentSection"
Grid.Column="1"
ContentSource="Header"
VerticalAlignment="Center"
HorizontalAlignment="Stretch"
Margin="5,0,0,0"/>
</Grid>
</StackPanel>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected"
Value="True">
<Setter TargetName="SelectedItem"
Property="Background"
Value="{StaticResource PreferencesWindowButtonColor}" />
<Setter Property="Foreground"
Value="{StaticResource PreferencesWindowFontColor}" />
<Setter Property="FontWeight"
Value="Bold" />
</Trigger>
<Trigger Property="IsSelected"
Value="False">
<Setter TargetName="SelectedItem"
Property="Background"
Value="{StaticResource PreferencesWindowBackgroundColor}" />
<Setter Property="Foreground"
Value="{StaticResource TabItemUnSelected}" />
<Setter Property="FontWeight"
Value="Bold" />
</Trigger>
<Trigger Property="Border.IsMouseOver"
Value="True">
<Setter TargetName="TabBorder"
Property="Background"
Value="{StaticResource PreferencesWindowButtonPressedColor}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@
Focusable="False" />
<MenuItem Header="{x:Static p:Resources.DynamoViewDynamoMenuPreferences}"
Focusable="False"
Click="OnPreferencesWindowClick"
Visibility="Collapsed"
Name="preferencesOption"/>
<Separator />
Expand Down
9 changes: 9 additions & 0 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
using Dynamo.Wpf.Extensions;
using Dynamo.Wpf.Utilities;
using Dynamo.Wpf.ViewModels.Core;
using Dynamo.Wpf.Views;
using Dynamo.Wpf.Views.Debug;
using Dynamo.Wpf.Views.Gallery;
using Dynamo.Wpf.Views.PackageManager;
Expand Down Expand Up @@ -1845,6 +1846,14 @@ private void OnDebugModesClick(object sender, RoutedEventArgs e)
debugModesWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
debugModesWindow.ShowDialog();
}

private void OnPreferencesWindowClick(object sender, RoutedEventArgs e)
{
var preferencesWindow = new PreferencesWindow();
preferencesWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
preferencesWindow.ShowDialog();
}

/// <summary>
/// Setup the "Samples" sub-menu with contents of samples directory.
/// </summary>
Expand Down
Loading

0 comments on commit b9416cc

Please sign in to comment.