Skip to content

Commit

Permalink
Merge branch 'master' into DYN-8121-SplashScreen-Disable-CloseButton-…
Browse files Browse the repository at this point in the history
…Dynamo
  • Loading branch information
RobertGlobant20 committed Jan 17, 2025
2 parents ccdfc35 + 2c89ba7 commit 0f49cc3
Show file tree
Hide file tree
Showing 41 changed files with 1,032 additions and 176 deletions.
6 changes: 3 additions & 3 deletions src/DynamoCore/DynamoCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
<ItemGroup Label="Common dependencies">
<PackageReference Include="Autodesk.IDSDK" Version="1.2.4" />
<PackageReference Include="Greg" Version="3.0.2.6533" />
<PackageReference Include="DynamoVisualProgramming.LibG_230_0_0" Version="3.0.0.6876" GeneratePathProperty="true" ExcludeAssets="all"/>
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0" Version="3.4.0.3231" Condition=" '$(Configuration)' == 'Release' " GeneratePathProperty="true" ExcludeAssets="runtime"/>
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0_debug" Version="3.4.0.3231" Condition=" '$(Configuration)' == 'Debug' " GeneratePathProperty="true" ExcludeAssets="runtime"/>
<PackageReference Include="DynamoVisualProgramming.LibG_230_0_0" Version="3.0.0.7226" GeneratePathProperty="true" ExcludeAssets="all"/>
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0" Version="3.4.0.3546" Condition=" '$(Configuration)' == 'Release' " GeneratePathProperty="true" ExcludeAssets="runtime"/>
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0_debug" Version="3.4.0.3546" Condition=" '$(Configuration)' == 'Debug' " GeneratePathProperty="true" ExcludeAssets="runtime"/>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" CopyXML="true" />
<PackageReference Include="RestSharp" Version="112.0.0" CopyXML="true" />
<PackageReference Include="Lucene.Net" Version="4.8.0-beta00016" />
Expand Down
14 changes: 10 additions & 4 deletions src/DynamoCore/Logging/DynamoAnalyticsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void TrackEvent(Actions action, Categories category, string description,
{
serviceInitialized.Wait();

lock(trackEventLockObj)
lock (trackEventLockObj)
{
if (!ReportingAnalytics) return;

Expand Down Expand Up @@ -403,7 +403,7 @@ public void EndEventTask(Task<IDisposable> taskToEnd)

Task.Run(() =>
{
lock(trackEventLockObj)
lock (trackEventLockObj)
{
taskToEnd.Wait();
taskToEnd.Result.Dispose();
Expand All @@ -417,7 +417,7 @@ public IDisposable TrackFileOperationEvent(string filepath, Actions operation, i
serviceInitialized.Wait();
if (!ReportingAnalytics) return Disposable;

lock(trackEventLockObj)
lock (trackEventLockObj)
{
var e = new FileOperationEvent()
{
Expand Down Expand Up @@ -469,7 +469,13 @@ public void Dispose()
// If the Analytics Client was initialized, shut it down.
// Otherwise skip this step because it would cause an exception.
if (Service.IsInitialized)
Service.ShutDown();
{
// Lock shutdown sequence in case other tracking calls might be executing concurently.
lock (trackEventLockObj)
{
Service.ShutDown();
}
}

if (Session != null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
<PackageReference Include="HelixToolkit.Core.Wpf" Version="2.24.0" />
<PackageReference Include="HelixToolkit.SharpDX.Core.Wpf" Version="2.24.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="5.0.0" />
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0" Version="3.4.0.3231"/>
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0" Version="3.4.0.3546"/>
<PackageReference Include="FontAwesome5" Version="2.1.11" />
<PackageReference Include="AvalonEdit" Version="6.3.0.90" CopyXML="true" />
<PackageReference Include="Greg" Version="3.0.2.6533" />
Expand Down
35 changes: 33 additions & 2 deletions src/DynamoCoreWpf/Interfaces/IWatchHandler.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
using System;

using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Dynamo.Configuration;
using Newtonsoft.Json.Linq;

using Dynamo.Extensions;
using Dynamo.ViewModels;
using Dynamo.Wpf.Properties;
using ProtoCore.DSASM;
using ProtoCore.Mirror;
using ProtoCore.Utils;
using Newtonsoft.Json;

namespace Dynamo.Interfaces
{
Expand Down Expand Up @@ -83,7 +86,18 @@ private WatchViewModel ProcessThing(object value, ProtoCore.RuntimeCore runtimeC

return node;
}
if (value is JObject obj)
{
var dict = ConvertJObjectToDictionary(obj);
var node = new WatchViewModel(dict.Keys.Any() ? WatchViewModel.DICTIONARY : WatchViewModel.EMPTY_DICTIONARY, tag, RequestSelectGeometry, true);

foreach (var e in dict.Keys.Zip(dict.Values, (key, val) => new { key, val }))
{
node.Children.Add(ProcessThing(e.val, runtimeCore, tag + ":" + e.key, showRawData, callback));
}

return node;
}
if (!(value is string) && value is IEnumerable)
{
var list = (value as IEnumerable).Cast<dynamic>().ToList();
Expand Down Expand Up @@ -122,6 +136,23 @@ private WatchViewModel ProcessThing(object value, ProtoCore.RuntimeCore runtimeC
return new WatchViewModel(value, tag, RequestSelectGeometry);
}

private static Dictionary<string, object> ConvertJObjectToDictionary(JObject jObject)
{
var settings = new JsonSerializerSettings
{
// Add any specific settings you need here
NullValueHandling = NullValueHandling.Ignore,
MissingMemberHandling = MissingMemberHandling.Ignore,
TypeNameHandling = TypeNameHandling.None
};

var json = jObject.ToString();
var dictionary = JsonConvert.DeserializeObject<Dictionary<string, object>>(json, settings);

return dictionary;
}


private WatchViewModel ProcessThing(double value, ProtoCore.RuntimeCore runtimeCore, string tag, bool showRawData, WatchHandlerCallback callback)
{
return new WatchViewModel(value, tag, RequestSelectGeometry);
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.

12 changes: 6 additions & 6 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ You can always redownload the package.</value>
<data name="MessageFailedToFindNodeById" xml:space="preserve">
<value>No node could be found with that Id.</value>
</data>
<data name="MessageFailedToFindGroupById" xml:space="preserve">
<data name="MessageFailedToFindGroupById" xml:space="preserve">
<value>No group could be found with that Id.</value>
</data>
<data name="MessageFailedToOpenCorruptedFile" xml:space="preserve">
Expand Down Expand Up @@ -4057,15 +4057,12 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageDetailsCompatibilityWithSetup" xml:space="preserve">
<value>Compatible with your current setup</value>
</data>
<data name="PackageDetailsIncompatibilityWithSetup" xml:space="preserve">
<data name="PackageDetailsIncompatibilityWithSetup" xml:space="preserve">
<value>Incompatible with your current setup</value>
</data>
<data name="PackageDetailsXCompatibilityWithSetup" xml:space="preserve">
<value>Unknown compatibility with your current setup</value>
</data>
<data name="PackageDetailsSize" xml:space="preserve">
<value>Size</value>
</data>
<data name="PackageDetailsCompatibleVersionTooltip" xml:space="preserve">
<value>This version should be compatible with your current setup</value>
</data>
Expand Down Expand Up @@ -4105,4 +4102,7 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageVersionTooltip" xml:space="preserve">
<value>Versions marked with .x include all versions in the specified major or minor release</value>
</data>
</root>
<data name="PackageUnknownCompatibilityVersionDownloadMsg" xml:space="preserve">
<value>The compatibility of this version with your setup has not been verified. It may or may not work as expected.</value>
</data>
</root>
12 changes: 6 additions & 6 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1924,7 +1924,7 @@ Do you want to install the latest Dynamo update?</value>
<data name="MessageFailedToFindNodeById" xml:space="preserve">
<value>No node could be found with that Id.</value>
</data>
<data name="MessageFailedToFindGroupById" xml:space="preserve">
<data name="MessageFailedToFindGroupById" xml:space="preserve">
<value>No group could be found with that Id.</value>
</data>
<data name="MessageFailedToOpenCorruptedFile" xml:space="preserve">
Expand Down Expand Up @@ -4044,15 +4044,12 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageDetailsCompatibilityWithSetup" xml:space="preserve">
<value>Compatible with your current setup</value>
</data>
<data name="PackageDetailsIncompatibilityWithSetup" xml:space="preserve">
<data name="PackageDetailsIncompatibilityWithSetup" xml:space="preserve">
<value>Incompatible with your current setup</value>
</data>
<data name="PackageDetailsXCompatibilityWithSetup" xml:space="preserve">
<value>Unknown compatibility with your current setup</value>
</data>
<data name="PackageDetailsSize" xml:space="preserve">
<value>Size</value>
</data>
<data name="PackageDetailsCompatibleVersionTooltip" xml:space="preserve">
<value>This version should be compatible with your current setup</value>
</data>
Expand Down Expand Up @@ -4092,4 +4089,7 @@ To make this file into a new template, save it to a different folder, then move
<data name="PackageVersionTooltip" xml:space="preserve">
<value>Versions marked with .x include all versions in the specified major or minor release</value>
</data>
</root>
<data name="PackageUnknownCompatibilityVersionDownloadMsg" xml:space="preserve">
<value>The compatibility of this version with your setup has not been verified. It may or may not work as expected. </value>
</data>
</root>
1 change: 1 addition & 0 deletions src/DynamoCoreWpf/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5224,6 +5224,7 @@ static Dynamo.Wpf.Properties.Resources.PackageUploadStateError.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUploadStateReady.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUploadStateUploaded.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUploadStateUploading.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUnknownCompatibilityVersionDownloadMsg.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUseNewerDynamoMessageBoxTitle.get -> string
static Dynamo.Wpf.Properties.Resources.PackageUseOlderDynamoMessageBoxTitle.get -> string
static Dynamo.Wpf.Properties.Resources.PackageViewContextMenuLoadText.get -> string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -751,10 +751,31 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,
string msg;
MessageBoxResult result;

var compatible = PackageManagerSearchElement.CalculateCompatibility(package.compatibility_matrix);
if (compatible == false && !DynamoModel.IsTestMode)
// initialize default download consent message
msg = String.IsNullOrEmpty(installPath) ?
String.Format(Resources.MessageConfirmToInstallPackage, name, package.version) :
String.Format(Resources.MessageConfirmToInstallPackageToFolder, name, package.version, installPath);

// Calculate compatibility and display a single download consent across cases
var compatible = PackageManagerSearchElement.CalculateCompatibility(package.compatibility_matrix);

// Unknown package compatibility with current Dynamo env, this is expected to be the most popular case for now
if (compatible == null && !DynamoModel.IsTestMode)
{
msg = Resources.PackageManagerIncompatibleVersionDownloadMsg;
msg = msg + "\n\n" + Resources.PackageUnknownCompatibilityVersionDownloadMsg;
result = MessageBoxService.Show(ViewModelOwner, msg,
Resources.PackageDownloadConfirmMessageBoxTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Question);

if (result != MessageBoxResult.OK)
{
return;
}
}
// Package incompatible with current Dynamo env
else if (compatible == false && !DynamoModel.IsTestMode)
{
msg = msg + "\n\n" + Resources.PackageManagerIncompatibleVersionDownloadMsg;
result = MessageBoxService.Show(ViewModelOwner, msg,
Resources.PackageManagerIncompatibleVersionDownloadTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Warning);
Expand All @@ -764,14 +785,13 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,
return;
}
}

msg = String.IsNullOrEmpty(installPath) ?
String.Format(Resources.MessageConfirmToInstallPackage, name, package.version) :
String.Format(Resources.MessageConfirmToInstallPackageToFolder, name, package.version, installPath);

result = MessageBoxService.Show(ViewModelOwner, msg,
Resources.PackageDownloadConfirmMessageBoxTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Question);
// Package compatible with current Dynamo env
else
{
result = MessageBoxService.Show(ViewModelOwner, msg,
Resources.PackageDownloadConfirmMessageBoxTitle,
MessageBoxButton.OKCancel, MessageBoxImage.Question);
}

var pmExt = DynamoViewModel.Model.GetPackageManagerExtension();
if (result == MessageBoxResult.OK)
Expand Down Expand Up @@ -898,8 +918,8 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,

var containsPackagesThatTargetOtherHosts = PackageManagerExtension.CheckIfPackagesTargetOtherHosts(newPackageHeaders);

// if any do, notify user and allow cancellation
if (containsPackagesThatTargetOtherHosts)
// if unknown compatibility, and package target other hosts, notify user and allow cancellation
if (compatible == null && containsPackagesThatTargetOtherHosts)
{
var res = MessageBoxService.Show(ViewModelOwner,
Resources.MessagePackageTargetOtherHosts,
Expand Down Expand Up @@ -957,11 +977,11 @@ internal async void ExecutePackageDownload(string name, PackageVersion package,
}
}
}
catch(ArgumentException ex)
catch (ArgumentException ex)
{
DynamoConsoleLogger.OnLogMessageToDynamoConsole($"exception while trying to compare version info between package and dynamo {ex}");
}
catch(FormatException ex)
catch (FormatException ex)
{
DynamoConsoleLogger.OnLogMessageToDynamoConsole($"exception while trying to compare version info between package and dynamo {ex}");
}
Expand Down
12 changes: 12 additions & 0 deletions src/DynamoCoreWpf/ViewModels/Preview/WatchViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,12 @@ private static string GetStringFromObject(object obj)
return ((DateTime)obj).ToString(PreferenceSettings.DefaultDateFormat, CultureInfo.InvariantCulture);
case TypeCode.Object:
return ObjectToLabelString(obj);
case TypeCode.Byte:
return ((byte)obj).ToString(CultureInfo.InvariantCulture);
case TypeCode.UInt32:
return ((uint)obj).ToString(CultureInfo.InvariantCulture);
case TypeCode.UInt64:
return ((ulong)obj).ToString(CultureInfo.InvariantCulture);
default:
return (string)obj;
};
Expand Down Expand Up @@ -313,6 +319,12 @@ private string GetDisplayType(object obj)
return nameof(TypeCode.Object);
case TypeCode.String:
return nameof(TypeCode.String);
case TypeCode.Byte:
return nameof(TypeCode.Byte);
case TypeCode.UInt32:
return nameof(TypeCode.UInt32);
case TypeCode.UInt64:
return nameof(TypeCode.UInt64);
case TypeCode.Empty:
return String.Empty;
default:
Expand Down
2 changes: 2 additions & 0 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2378,6 +2378,8 @@ private void HandlePackageManagerWindowClosed(object sender, EventArgs e)

var cmd = Analytics.TrackCommandEvent("PackageManager");
cmd.Dispose();

this.Activate();
}

/// <summary>
Expand Down
7 changes: 5 additions & 2 deletions src/DynamoCoreWpf/Views/Core/NoteView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public partial class NoteView : IViewModelView<NoteViewModel>
/// <summary>
/// Special keys definition in note
/// </summary>
internal Key[] specialKeys = { Key.OemMinus, Key.Tab, Key.Enter };
internal Key[] specialKeys = { Key.OemMinus, Key.Subtract, Key.Tab, Key.Enter };

public NoteViewModel ViewModel { get; private set; }

Expand Down Expand Up @@ -210,7 +210,7 @@ private void noteTextBox_LostFocus(object sender, RoutedEventArgs e)

private void noteTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (!specialKeys.Contains(e.Key))
if (!specialKeys.Contains(e.Key) || Keyboard.Modifiers == System.Windows.Input.ModifierKeys.Shift)
{
return;
}
Expand All @@ -232,6 +232,9 @@ private void noteTextBox_PreviewKeyDown(object sender, KeyEventArgs e)
case Key.OemMinus:
textBox.Text = BulletDashHandler(text, caretIndex);
break;
case Key.Subtract:
textBox.Text = BulletDashHandler(text, caretIndex);
break;
case Key.Tab:
textBox.Text = BulletTabHandler(text, caretIndex);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/Views/Preview/WatchTree.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class WatchTree : UserControl
private readonly double widthPerCharacter = 7.5;
private static readonly int defaultHeightSize = 200;
private readonly int minWidthSize = 100;
private readonly int minHeightSize = 38;
private readonly int minHeightSize = 40;
private readonly int minHeightForList = 83;

public WatchTree(WatchViewModel vm)
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoManipulation/DynamoManipulation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0" Version="3.4.0.3231" />
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0" Version="3.4.0.3546" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
Expand Down
2 changes: 1 addition & 1 deletion src/Libraries/Analysis/Analysis.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<None Remove="AnalysisImages.resources" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0" Version="3.4.0.3231"/>
<PackageReference Include="DynamoVisualProgramming.LibG_231_0_0" Version="3.4.0.3546"/>
<ProjectReference Include="..\..\DynamoCore\DynamoCore.csproj">
<Project>{7858fa8c-475f-4b8e-b468-1f8200778cf8}</Project>
<Name>DynamoCore</Name>
Expand Down
Loading

0 comments on commit 0f49cc3

Please sign in to comment.