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

Enable python zoom scale in Dynamo Preferences Panel #13798

Merged
merged 16 commits into from
Mar 9, 2023
7 changes: 7 additions & 0 deletions src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ public bool IsADPAnalyticsReportingApproved
/// </summary>
public int LibraryZoomScale { get; set; }

/// <summary>
/// Indicates the zoom scale of the Python editor
/// </summary>
public int PythonScriptZoomScale { get; set; }

/// <summary>
/// The types of connector: Bezier or Polyline.
/// </summary>
Expand Down Expand Up @@ -783,6 +788,7 @@ public PreferenceSettings()
BackupFiles = new List<string>();

LibraryZoomScale = 100;
PythonScriptZoomScale = 22;

CustomPackageFolders = new List<string>();

Expand Down Expand Up @@ -1205,5 +1211,6 @@ public bool IsCreatedFromValidFile
{
get { return isCreatedFromValidFile; }
}

}
}
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
[assembly: InternalsVisibleTo("PackageDetailsViewExtension")]
[assembly: InternalsVisibleTo("Notifications")]
[assembly: InternalsVisibleTo("LibraryViewExtensionWebView2")]
[assembly: InternalsVisibleTo("PythonNodeModelsWpf")]
[assembly: InternalsVisibleTo("IronPythonTests")]
[assembly: InternalsVisibleTo("DynamoPackagesWPF")]
[assembly: InternalsVisibleTo("DynamoPlayerExtension")]
Expand Down
54 changes: 54 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.

18 changes: 18 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3497,6 +3497,9 @@ 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="PythonZoomScaleTooltipText" xml:space="preserve">
<value>Drag to adjust Python Editor zoom scale between 10% and 100%. You can also adjust this in Python Editor by pressing Shift and scrolling the mouse wheel.</value>
</data>
<data name="CustomColorPickerApplyBtn" xml:space="preserve">
<value>Apply</value>
</data>
Expand All @@ -3515,4 +3518,19 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="CustomColorPickerTitle" xml:space="preserve">
<value>Color</value>
</data>
<data name="PreferencesViewZoomScaling0Percent" xml:space="preserve">
<value>0%</value>
</data>
<data name="PreferencesViewZoomScaling100Percent" xml:space="preserve">
<value>100%</value>
</data>
<data name="PreferencesViewZoomScaling10Percent" xml:space="preserve">
<value>10%</value>
</data>
<data name="PreferencesViewZoomScaling25Percent" xml:space="preserve">
<value>25%</value>
</data>
<data name="PreferencesViewZoomScaling300Percent" xml:space="preserve">
<value>300%</value>
</data>
</root>
18 changes: 18 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3484,6 +3484,9 @@ 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="PythonZoomScaleTooltipText" xml:space="preserve">
<value>Drag to adjust Python Editor zoom scale between 10% and 100%. You can also adjust this in Python Editor by pressing Shift and scrolling the mouse wheel.</value>
</data>
<data name="CustomColorPickerApplyBtn" xml:space="preserve">
<value>Apply</value>
</data>
Expand All @@ -3502,4 +3505,19 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="CustomColorPickerTitle" xml:space="preserve">
<value>Color</value>
</data>
<data name="PreferencesViewZoomScaling0Percent" xml:space="preserve">
<value>0%</value>
</data>
<data name="PreferencesViewZoomScaling100Percent" xml:space="preserve">
<value>100%</value>
</data>
<data name="PreferencesViewZoomScaling10Percent" xml:space="preserve">
<value>10%</value>
</data>
<data name="PreferencesViewZoomScaling25Percent" xml:space="preserve">
<value>25%</value>
</data>
<data name="PreferencesViewZoomScaling300Percent" xml:space="preserve">
<value>300%</value>
</data>
</root>
10 changes: 10 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,16 @@ void Watch3DViewModelPropertyChanged(object sender, PropertyChangedEventArgs e)
}
}


internal event EventHandler PreferencesWindowChanged;
internal void OnPreferencesWindowChanged(object preferencesView)
{
if(PreferencesWindowChanged != null)
{
PreferencesWindowChanged(preferencesView, new EventArgs());
}
}

internal event EventHandler NodeViewReady;
internal void OnNodeViewReady(object nodeView)
{
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1226,7 +1226,7 @@ public virtual void OnRequestShowFileDialog(object sender, PythonTemplatePathEve

public DelegateCommand AddPythonPathCommand { get; private set; }
public DelegateCommand DeletePythonPathCommand { get; private set; }
public DelegateCommand UpdatePythonPathCommand { get; private set; }
public DelegateCommand UpdatePythonPathCommand { get; private set; }

private void InitializeCommands()
{
Expand Down
4 changes: 1 addition & 3 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ internal PreferencesView PreferencesWindow {
get { return preferencesWindow; }
}

internal event Action OnPreferencesWindowChanged;

/// <summary>
/// Constructor
/// </summary>
Expand Down Expand Up @@ -1913,7 +1911,7 @@ private void OnDebugModesClick(object sender, RoutedEventArgs e)
private void OnPreferencesWindowClick(object sender, RoutedEventArgs e)
{
preferencesWindow = new PreferencesView(this);
OnPreferencesWindowChanged();
dynamoViewModel.OnPreferencesWindowChanged(preferencesWindow);
preferencesWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
preferencesWindow.ShowDialog();
}
Expand Down
110 changes: 89 additions & 21 deletions src/DynamoCoreWpf/Views/Menu/PreferencesView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@
</Image>
</StackPanel>
<StackPanel Margin="-10,5,0,0" Orientation="Horizontal" Grid.Row="2">
<Label Content="0%"
<Label Content="{x:Static p:Resources.PreferencesViewZoomScaling0Percent}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

localized instead of hardcode

Name="lblConfidenceLevelLabelStart"
VerticalAlignment="Center"
Foreground="{StaticResource PreferencesWindowFontColor}"
Expand All @@ -827,7 +827,7 @@
IsEnabled="{Binding Path=EnableConfidenceLevelSlider}"
ValueChanged="sliderConfidenceLevel_ValueChanged">
</Slider>
<Label Content="100%"
<Label Content="{x:Static p:Resources.PreferencesViewZoomScaling100Percent}"
Margin="0,-5,0,0"
VerticalAlignment="Center"
Foreground="{StaticResource PreferencesWindowFontColor}"
Expand Down Expand Up @@ -1246,17 +1246,22 @@
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,10,0,5" Grid.Row="0" Orientation="Horizontal">
<TextBlock FontSize="12" VerticalAlignment="Center" Text="{x:Static p:Resources.DynamoViewSettingLibraryZoomScale}"></TextBlock>
<Label HorizontalAlignment="Left"
<Grid x:Name="LibraryZoomScale" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,10,0,5" Grid.Row="0" Orientation="Horizontal">
<TextBlock FontSize="12" VerticalAlignment="Center" Text="{x:Static p:Resources.DynamoViewSettingLibraryZoomScale}"></TextBlock>
<Label HorizontalAlignment="Left"
Name="LibraryZoomScaleInfoLabel"
VerticalAlignment="Bottom"
Margin="0,2,0,0"
Height="26"
Width="53">
<Image
<Image
Width="14"
Height="14"
Margin="0,0,0,0"
Expand All @@ -1273,9 +1278,9 @@
</StackPanel>

<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1" Margin="0,0,0,3">
<TextBlock Text="25%"></TextBlock>
<TextBlock Text="{x:Static p:Resources.PreferencesViewZoomScaling25Percent}"></TextBlock>

<Slider
<Slider
x:Name="LibraryZoomScalingSlider"
Style="{StaticResource SliderStyle}"
ValueChanged="zoomScaleLevel_ValueChanged"
Expand All @@ -1285,26 +1290,89 @@
IsSnapToTickEnabled="True"
TickFrequency="1"
Maximum="300">
</Slider>
<TextBlock Text="300%"></TextBlock>
</Slider>
<TextBlock Text="{x:Static p:Resources.PreferencesViewZoomScaling300Percent}"></TextBlock>

</StackPanel>
<StackPanel Grid.Row="2" Width="550">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<Label
</StackPanel>
<StackPanel Grid.Row="2" Width="550">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<Label
Name="lblZoomScalingValue"
Width="50"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
Foreground="{StaticResource PreferencesWindowFontColor}"
FontWeight="Regular"/>
</StackPanel>
</StackPanel>
</Grid>
<Grid x:Name="PythonZoomScale" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<StackPanel Margin="0,10,0,5" Grid.Row="0" Orientation="Horizontal">
<TextBlock FontSize="12" VerticalAlignment="Center" Text="Python"></TextBlock>
<Label HorizontalAlignment="Left"
Name="PythonZoomScaleInfoLabel"
VerticalAlignment="Bottom"
Margin="0,2,0,0"
Height="26"
Width="53">
<Image
Width="14"
Height="14"
Margin="0,0,0,0"
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource QuestionIcon}"
ToolTipService.ShowDuration="30000">
<Image.ToolTip>
<ToolTip Content="{x:Static p:Resources.PythonZoomScaleTooltipText}" Style="{StaticResource GenericToolTipLight}"/>
</Image.ToolTip>
</Image>
</Label>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1" Margin="0,0,0,3">
<TextBlock Text="{x:Static p:Resources.PreferencesViewZoomScaling10Percent}"></TextBlock>
<Slider
x:Name="PythonZoomScalingSlider"
Style="{StaticResource SliderStyle}"
ValueChanged="PythonZoomScalingSlider_ValueChanged"
Width="400"
Margin="5,0,5,0"
Minimum="10"
IsSnapToTickEnabled="True"
TickFrequency="1"
Maximum="100">
</Slider>
<TextBlock Text="{x:Static p:Resources.PreferencesViewZoomScaling100Percent}"></TextBlock>

</StackPanel>
<StackPanel Grid.Row="2" Width="550">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
</Grid>
<Label
Name="lblPythonScalingValue"
Width="50"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
Foreground="{StaticResource PreferencesWindowFontColor}"
FontWeight="Regular"/>
</StackPanel>
</Grid>
</Grid>

</Expander>
</Grid>
</TabItem>
Expand Down
Loading