Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/DynamoDS/Dynamo into bump…
Browse files Browse the repository at this point in the history
…_to_3.1
  • Loading branch information
sm6srw committed Dec 8, 2023
2 parents d7b1f5e + e150a01 commit 3c81f8d
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Windows;
using System.Windows.Controls;
using Dynamo.Logging;
using Dynamo.Models;
using Dynamo.Utilities;
using DynamoUtilities;
using Microsoft.Web.WebView2.Core;
Expand Down Expand Up @@ -216,7 +217,14 @@ public void Dispose()
#region ILogSource Implementation
private void Log(string message)
{
viewModel.MessageLogged?.Invoke(LogMessage.Info(message));
if (DynamoModel.IsTestMode)
{
System.Console.WriteLine(message);
}
else
{
viewModel?.MessageLogged?.Invoke(LogMessage.Info(message));
}
}
#endregion
}
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.

23 changes: 22 additions & 1 deletion src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3861,4 +3861,25 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="NotificationToAgreeMLNodeautocompleteTOU" xml:space="preserve">
<value>To access the Recommended Nodes feature, please read and accept Dynamo &gt; Agreement and Terms of Use.</value>
</data>
</root>
<data name="GESUnitCentimeters" xml:space="preserve">
<value>Centimeters</value>
</data>
<data name="GESUnitFeet" xml:space="preserve">
<value>Feet</value>
</data>
<data name="GESUnitInches" xml:space="preserve">
<value>Inches</value>
</data>
<data name="GESUnitKilometers" xml:space="preserve">
<value>Kilometers</value>
</data>
<data name="GESUnitMeters" xml:space="preserve">
<value>Meters</value>
</data>
<data name="GESUnitMiles" xml:space="preserve">
<value>Miles</value>
</data>
<data name="GESUnitMillimeters" xml:space="preserve">
<value>Millimeters</value>
</data>
</root>
25 changes: 23 additions & 2 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -3602,7 +3602,7 @@ You can manage this in Preferences -&gt; Security.</value>
<data name="PackageDeprecatedTooltip" xml:space="preserve">
<value>This package is outdated and cannot be installed.</value>
</data>
<data name="PackageManagerMyPackagesPublishVersion" xml:space="preserve">
<data name="PackageManagerMyPackagesPublishVersion" xml:space="preserve">
<value>Publish Version</value>
</data>
<data name="SplashScreenViewExtensions" xml:space="preserve">
Expand Down Expand Up @@ -3848,4 +3848,25 @@ In certain complex graphs or host program scenarios, Automatic mode may cause in
<data name="NotificationToAgreeMLNodeautocompleteTOU" xml:space="preserve">
<value>To access the Recommended Nodes feature, please read and accept Dynamo &gt; Agreement and Terms of Use.</value>
</data>
</root>
<data name="GESUnitCentimeters" xml:space="preserve">
<value>Centimeters</value>
</data>
<data name="GESUnitFeet" xml:space="preserve">
<value>Feet</value>
</data>
<data name="GESUnitInches" xml:space="preserve">
<value>Inches</value>
</data>
<data name="GESUnitKilometers" xml:space="preserve">
<value>Kilometers</value>
</data>
<data name="GESUnitMeters" xml:space="preserve">
<value>Meters</value>
</data>
<data name="GESUnitMiles" xml:space="preserve">
<value>Miles</value>
</data>
<data name="GESUnitMillimeters" xml:space="preserve">
<value>Millimeters</value>
</data>
</root>
6 changes: 1 addition & 5 deletions src/DynamoCoreWpf/UI/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
using Dynamo.Search.SearchElements;
using Dynamo.UI;
using Dynamo.UI.Controls;
using Dynamo.Updates;
using Dynamo.Utilities;
using Dynamo.ViewModels;
using Dynamo.Wpf.Properties;
Expand Down Expand Up @@ -3898,10 +3897,7 @@ public object Convert(object value, Type targetType, object parameter,
CultureInfo culture)
{
if (value is string nullOrEmptyString && String.IsNullOrEmpty(nullOrEmptyString)) return Visibility.Visible;
if (value is string zeroString && zeroString.Equals("0"))
{
return Visibility.Visible;
}

return Visibility.Collapsed;
}

Expand Down
31 changes: 30 additions & 1 deletion src/DynamoCoreWpf/ViewModels/Menu/PreferencesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,35 @@ public bool importSettingsContent(string content)
return setSettings(newPreferences);
}

/// <summary>
/// Returns localized resource strings for Units
/// </summary>
private string GetLocalizedUnits(Enum value)
{
if (value != null)
{
switch (value)
{
case Configurations.Units.Millimeters:
return Res.GESUnitMillimeters;
case Configurations.Units.Centimeters:
return Res.GESUnitCentimeters;
case Configurations.Units.Kilometers:
return Res.GESUnitKilometers;
case Configurations.Units.Meters:
return Res.GESUnitMeters;
case Configurations.Units.Inches:
return Res.GESUnitInches;
case Configurations.Units.Feet:
return Res.GESUnitFeet;
case Configurations.Units.Miles:
return Res.GESUnitMiles;
}
}
return null;
}


private bool setSettings(PreferenceSettings newPreferences)
{
// Explicit copy
Expand Down Expand Up @@ -1381,7 +1410,7 @@ public PreferencesViewModel(DynamoViewModel dynamoViewModel)
SelectedLanguage = Configurations.SupportedLocaleDic.FirstOrDefault(x => x.Value == preferenceSettings.Locale).Key;

// Chose the scaling unit, if option is allowed by user
UnitList = Configurations.SupportedUnits.Keys.Select(x => x.ToString()).ToObservableCollection();
UnitList = Configurations.SupportedUnits.Keys.Select(x => GetLocalizedUnits(x)).ToObservableCollection();
SelectedUnits = Configurations.SupportedUnits.FirstOrDefault(x => x.Key.ToString() == preferenceSettings.GraphicScaleUnit).Key.ToString();

GroupStyleFontSizeList = preferenceSettings.PredefinedGroupStyleFontSizes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2411,22 +2411,6 @@ private void PreviewPackageBuild()
.ToList();
try
{
var unqualifiedFiles = GetAllUnqualifiedFiles();

if (files == null || files.Count() < 1 || unqualifiedFiles.Count() > 0)
{
string filesCannotBePublished = null;
foreach (var file in unqualifiedFiles)
{
filesCannotBePublished = filesCannotBePublished + file + "\n";
}
string FileNotPublishMessage = string.Format(Resources.FileNotPublishMessage, filesCannotBePublished);
UploadState = PackageUploadHandle.State.Error;
MessageBoxResult response = DynamoModel.IsTestMode ? MessageBoxResult.OK : MessageBoxService.Show(Owner, FileNotPublishMessage, Resources.FileNotPublishCaption, MessageBoxButton.OK, MessageBoxImage.Error);

return;
}

// Generate the Package Name, either based on the user 'Description', or the root path name, if no 'Description' yet
var packageName = !string.IsNullOrEmpty(Name) ? Name : Path.GetFileName(publishPath);
var rootItemPreview = RetainFolderStructureOverride ?
Expand Down
15 changes: 14 additions & 1 deletion src/Notifications/NotificationCenterController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Microsoft.Web.WebView2.Wpf;
using Dynamo.Utilities;
using Dynamo.Configuration;
using Dynamo.Models;

namespace Dynamo.Notifications
{
Expand Down Expand Up @@ -345,10 +346,22 @@ public void Dispose()
{
if (initState == AsyncMethodState.Started)
{
logger?.Log("NotificationCenterController is being disposed but async initialization is still not done");
Log("NotificationCenterController is being disposed but async initialization is still not done");
}
Dispose(true);
GC.SuppressFinalize(this);
}

private void Log(string msg)
{
if (DynamoModel.IsTestMode)
{
System.Console.WriteLine(msg);
}
else
{
logger?.Log(msg);
}
}
}
}
6 changes: 2 additions & 4 deletions test/DynamoCoreWpfTests/Utility/DispatcherUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public static class DispatcherUtil
/// <summary>
/// Force the Dispatcher to empty it's queue
/// </summary>
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public static void DoEvents()
{
var frame = new DispatcherFrame();
Expand All @@ -24,14 +23,13 @@ public static void DoEvents()
}

/// <summary>
/// Force the Dispatcher to empty it's queue every 100 ms for a maximum 4 seconds or until
/// Force the Dispatcher to empty it's queue every 100 ms for a maximum 20 seconds or until
/// the check function returns true.
/// </summary>
/// <param name="check">When check returns true, the even loop is stopped.</param>
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public static void DoEventsLoop(Func<bool> check = null)
{
const int max_count = 40;
const int max_count = 200;

int count = 0;
while (true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,9 @@ public void CanHandleDocsEventTriggeredFromDynamoViewModel()
// Act
var tabsBeforeExternalEventTrigger = this.ViewModel.SideBarTabItems.Count;
this.ViewModel.OpenDocumentationLinkCommand.Execute(docsEvent);

WaitForWebView2Initialization();

var tabsAfterExternalEventTrigger = this.ViewModel.SideBarTabItems.Count;
var htmlContent = GetSidebarDocsBrowserContents();

Expand Down

0 comments on commit 3c81f8d

Please sign in to comment.