Skip to content

Commit

Permalink
Add Debug Setting
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang committed Apr 14, 2020
1 parent 0783298 commit 790c3f9
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 4 deletions.
18 changes: 16 additions & 2 deletions src/DynamoCore/Configuration/DebugSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class DebugSettings : NotificationObject
{
private bool showDebugASTs = false;
private bool verboseLogging = false;
private bool showPythonEngineSwitcher = false;

/// <summary>
/// Enable verbose logging this is a lot of data
Expand All @@ -20,7 +21,7 @@ internal bool VerboseLogging
set
{
verboseLogging = value;
RaisePropertyChanged("VerboseLogging");
RaisePropertyChanged(nameof(VerboseLogging));
}
}

Expand All @@ -33,7 +34,20 @@ internal bool ShowDebugASTs
set
{
showDebugASTs = value;
RaisePropertyChanged("ShowDebugASTs");
RaisePropertyChanged(nameof(ShowDebugASTs));
}
}

/// <summary>
/// Enable Python Engine Switcher in Dynamo
/// </summary>
internal bool ShowPythonEngineSwitcher
{
get { return showPythonEngineSwitcher; }
set
{
showPythonEngineSwitcher = value;
RaisePropertyChanged(nameof(ShowPythonEngineSwitcher));
}
}
}
Expand Down
9 changes: 9 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.

4 changes: 4 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2245,4 +2245,8 @@ Uninstall the following packages: {0}?</value>
<data name="RenderingMemoryOutageSummary" xml:space="preserve">
<value>Dynamo has run out of memory trying to render your geometry. The geometry preview has been disabled.</value>
</data>
<data name="DynamoViewDebugMenuShowPythonEngineSwitcher" xml:space="preserve">
<value>Show Python Engine Switcher</value>
<comment>Debug menu | Show alternative Python engine switcher</comment>
</data>
</root>
4 changes: 4 additions & 0 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -2245,4 +2245,8 @@ Uninstall the following packages: {0}?</value>
<data name="RenderingMemoryOutageSummary" xml:space="preserve">
<value>Dynamo has run out of memory trying to render your geometry. The geometry preview has been disabled.</value>
</data>
<data name="DynamoViewDebugMenuShowPythonEngineSwitcher" xml:space="preserve">
<value>Show Python Engine Switcher</value>
<comment>Debug menu | Show alternative Python engine switcher</comment>
</data>
</root>
17 changes: 17 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Core/DynamoViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,23 @@ public bool VerboseLogging
}
}

/// <summary>
/// Enable Python Engine Switcher in Dynamo
/// </summary>
public bool ShowPythonEngineSwitcher
{
get { return model.DebugSettings.ShowPythonEngineSwitcher; }
set
{
model.DebugSettings.ShowPythonEngineSwitcher = value;
foreach(var nv in this.CurrentSpaceViewModel.Nodes)
{

}
RaisePropertyChanged(nameof(ShowPythonEngineSwitcher));
}
}

public bool ShowDebugASTs
{
get { return IsDebugBuild && model.DebugSettings.ShowDebugASTs; }
Expand Down
4 changes: 4 additions & 0 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,10 @@
Header="{x:Static p:Resources.DynamoViewDebugMenuDumpLibrary}"
Command="{Binding DumpLibraryToXmlCommand}"
IsEnabled="True" />
<MenuItem Focusable="False"
IsCheckable="True"
IsChecked="{Binding ShowPythonEngineSwitcher}"
Header="{x:Static p:Resources.DynamoViewDebugMenuShowPythonEngineSwitcher}" />
</MenuItem>
</Menu>

Expand Down
4 changes: 2 additions & 2 deletions src/Libraries/PythonNodeModelsWpf/PythonNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public void CustomizeView(PythonNode nodeModel, NodeView nodeView)
dynamoViewModel = nodeView.ViewModel.DynamoViewModel;
workspaceModel = nodeView.ViewModel.WorkspaceViewModel.Model;

// If it is a Debug build, display a pythone engine switcher
if (dynamoViewModel.IsDebugBuild)
// If it is a Debug build, display a python engine switcher
if (dynamoViewModel.ShowPythonEngineSwitcher)
{
var editWindowItem = new MenuItem { Header = PythonNodeModels.Properties.Resources.EditHeader, IsCheckable = false };
nodeView.MainContextMenu.Items.Add(editWindowItem);
Expand Down

0 comments on commit 790c3f9

Please sign in to comment.