Skip to content

Commit

Permalink
Enable python zoom scale in Dynamo Preferences Panel (DynamoDS#13798)
Browse files Browse the repository at this point in the history
* python zoom scale

* python zoom scale preference settings

* fix old comments

* remove unused variables

* tooltip localization

* Comments

* updates

* clean up

* update

* Update Python Editor Label

* Update test

* Comments

---------

Co-authored-by: Aaron (Qilong) <[email protected]>
Co-authored-by: Aaron (Qilong) <[email protected]>
  • Loading branch information
3 people authored and sm6srw committed Mar 29, 2023
1 parent ab2bfed commit 0fb08ad
Show file tree
Hide file tree
Showing 13 changed files with 338 additions and 74 deletions.
7 changes: 7 additions & 0 deletions src/DynamoCore/Configuration/PreferenceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,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 @@ -789,6 +794,7 @@ public PreferenceSettings()
BackupFiles = new List<string>();

LibraryZoomScale = 100;
PythonScriptZoomScale = 22;

CustomPackageFolders = new List<string>();

Expand Down Expand Up @@ -1211,5 +1217,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
63 changes: 63 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.

22 changes: 22 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3494,6 +3494,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="PreferencesViewLanguageSwitchHelp" xml:space="preserve">
<value>Dynamo must be relaunched to apply the language selection.</value>
</data>
Expand All @@ -3515,4 +3518,23 @@ 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>
<data name="PreferencesViewPythonEditorLable" xml:space="preserve">
<value>Python Editor</value>
<comment>Preferences -&gt; ZoomScalling -&gt; Python Editor</comment>
</data>
</root>
22 changes: 22 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3481,6 +3481,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="PreferencesViewLanguageSwitchHelp" xml:space="preserve">
<value>Dynamo must be relaunched to apply the language selection.</value>
</data>
Expand All @@ -3502,4 +3505,23 @@ 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>
<data name="PreferencesViewPythonEditorLable" xml:space="preserve">
<value>Python Editor</value>
<comment>Preferences -&gt; ZoomScalling -&gt; Python Editor</comment>
</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 @@ -1195,7 +1195,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
Loading

0 comments on commit 0fb08ad

Please sign in to comment.