From 28dda9ca176271334ad798b09aaa3d88ab930a68 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Thu, 27 Jun 2024 22:01:14 -0400 Subject: [PATCH 1/2] fix info bubble updates --- src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs b/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs index ed38fdf765a..753a27c3da2 100644 --- a/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs +++ b/src/DynamoCore/Graph/Workspaces/HomeWorkspaceModel.cs @@ -708,6 +708,9 @@ private void OnUpdateGraphCompleted(AsyncTask task) } } + // All nodes that have runtime warnings or infos + HashSet nodesWithInfos = [.. warnings.Keys]; + // Update node info message. foreach (var info in updateTask.RuntimeInfos) { @@ -716,6 +719,8 @@ private void OnUpdateGraphCompleted(AsyncTask task) if (node == null) continue; + nodesWithInfos.Add(guid); + // Block Infos updates during the many errors/warnings/notifications added here // InfoBubbles will be updated on NodeViewModel's EvaluationCompleted handler. using (node.PropertyChangeManager.SetPropsToSuppress(nameof(NodeModel.Infos), nameof(NodeModel.State))) @@ -735,8 +740,8 @@ private void OnUpdateGraphCompleted(AsyncTask task) // Dispatch the failure message display for execution on UI thread. // EvaluationCompletedEventArgs e = task.Exception == null || IsTestMode - ? new EvaluationCompletedEventArgs(true,warnings.Keys,null) - : new EvaluationCompletedEventArgs(true, warnings.Keys, task.Exception); + ? new EvaluationCompletedEventArgs(true, nodesWithInfos, null) + : new EvaluationCompletedEventArgs(true, nodesWithInfos, task.Exception); EvaluationCount ++; From 1e0b7e6f17fa4b05b922ab008d8f52327a6c22d5 Mon Sep 17 00:00:00 2001 From: pinzart90 Date: Thu, 27 Jun 2024 22:52:02 -0400 Subject: [PATCH 2/2] add test --- test/DynamoCoreWpfTests/PreviewBubbleTests.cs | 19 +++ test/UI/GeometryScalingInfoBubble.dyn | 160 ++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 test/UI/GeometryScalingInfoBubble.dyn diff --git a/test/DynamoCoreWpfTests/PreviewBubbleTests.cs b/test/DynamoCoreWpfTests/PreviewBubbleTests.cs index 3150e97956f..a74513ace20 100644 --- a/test/DynamoCoreWpfTests/PreviewBubbleTests.cs +++ b/test/DynamoCoreWpfTests/PreviewBubbleTests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Windows; using System.Windows.Controls; @@ -7,6 +8,7 @@ using CoreNodeModels; using Dynamo.Controls; using Dynamo.Graph.Nodes; +using Dynamo.Graph.Workspaces; using Dynamo.Models; using Dynamo.Utilities; using DynamoCoreWpfTests.Utility; @@ -915,6 +917,23 @@ public void PreviewBubble_CopyToClipboard() Assert.AreEqual(singleItemTreeExpected, clipboardContent); } + [Test] + public void GeometryScalingInfoBubble() + { + Open(@"UI\GeometryScalingInfoBubble.dyn"); + var workspace = ViewModel.Model.CurrentWorkspace as HomeWorkspaceModel; + Debug.Assert(workspace != null, nameof(workspace) + " != null"); + workspace.Run(); + + List errorNodes = ViewModel.Model.CurrentWorkspace.Nodes.ToList().FindAll(n => n.State == ElementState.Error); + List warningNodes = ViewModel.Model.CurrentWorkspace.Nodes.ToList().FindAll(n => n.State == ElementState.Warning || n.State == ElementState.PersistentWarning); + List infoNodes = ViewModel.Model.CurrentWorkspace.Nodes.ToList().FindAll(n => n.State == ElementState.Info); + + Assert.AreEqual(0, errorNodes.Count); + Assert.AreEqual(0, warningNodes.Count); + Assert.AreEqual(1, infoNodes.Count); + } + private bool ElementIsInContainer(FrameworkElement element, FrameworkElement container, int offset) { var relativePosition = element.TranslatePoint(new Point(), container); diff --git a/test/UI/GeometryScalingInfoBubble.dyn b/test/UI/GeometryScalingInfoBubble.dyn new file mode 100644 index 00000000000..4bf49a47ebe --- /dev/null +++ b/test/UI/GeometryScalingInfoBubble.dyn @@ -0,0 +1,160 @@ +{ + "Uuid": "dbf58b8e-9c0f-4739-b651-86909a9ff802", + "IsCustomNode": false, + "Description": "", + "Name": "GeometryScalingInfoBubble", + "ElementResolver": { + "ResolutionMap": {} + }, + "Inputs": [], + "Outputs": [], + "Nodes": [ + { + "ConcreteType": "Dynamo.Graph.Nodes.ZeroTouch.DSFunction, DynamoCore", + "Id": "f16400ac984e4818800d15aa324a0956", + "NodeType": "FunctionNode", + "Inputs": [ + { + "Id": "aff3dd620552421a8628da8a3712cc98", + "Name": "x", + "Description": "X coordinate\n\ndouble\nDefault value : 0", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "2ac43c47bd4149d988fa8f62896bfd05", + "Name": "y", + "Description": "Y coordinate\n\ndouble\nDefault value : 0", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + }, + { + "Id": "d56001c28a0247409c740f4f48c79126", + "Name": "z", + "Description": "Z coordinate\n\ndouble\nDefault value : 0", + "UsingDefaultValue": true, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Outputs": [ + { + "Id": "7069ed19976246f382c3765f78657b08", + "Name": "Point", + "Description": "Point created by coordinates", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "FunctionSignature": "Autodesk.DesignScript.Geometry.Point.ByCoordinates@double,double,double", + "Replication": "Auto", + "Description": "Form a Point given 3 cartesian coordinates\n\nPoint.ByCoordinates (x: double = 0, y: double = 0, z: double = 0): Point" + }, + { + "ConcreteType": "CoreNodeModels.Input.DoubleInput, CoreNodeModels", + "NumberType": "Double", + "Id": "7556b378a2484190bb10ee4c5c8f89cc", + "NodeType": "NumberInputNode", + "Inputs": [], + "Outputs": [ + { + "Id": "05869dc333194864b3dff3efda633d9e", + "Name": "", + "Description": "Double", + "UsingDefaultValue": false, + "Level": 2, + "UseLevels": false, + "KeepListStructure": false + } + ], + "Replication": "Disabled", + "Description": "Creates a number", + "InputValue": 2000000000.0 + } + ], + "Connectors": [ + { + "Start": "05869dc333194864b3dff3efda633d9e", + "End": "d56001c28a0247409c740f4f48c79126", + "Id": "761c9400d67e4425b0c559faec43f5b2", + "IsHidden": "False" + } + ], + "Dependencies": [], + "NodeLibraryDependencies": [], + "EnableLegacyPolyCurveBehavior": null, + "Thumbnail": "", + "GraphDocumentationURL": null, + "ExtensionWorkspaceData": [ + { + "ExtensionGuid": "28992e1d-abb9-417f-8b1b-05e053bee670", + "Name": "Properties", + "Version": "3.2", + "Data": {} + } + ], + "Author": "", + "Linting": { + "activeLinter": "None", + "activeLinterId": "7b75fb44-43fd-4631-a878-29f4d5d8399a", + "warningCount": 0, + "errorCount": 0 + }, + "Bindings": [], + "View": { + "Dynamo": { + "ScaleFactor": 1.0, + "HasRunWithoutCrash": true, + "IsVisibleInDynamoLibrary": true, + "Version": "3.2.1.5440", + "RunType": "Manual", + "RunPeriod": "1000" + }, + "Camera": { + "Name": "_Background Preview", + "EyeX": -17.0, + "EyeY": 24.0, + "EyeZ": 50.0, + "LookX": 12.0, + "LookY": -13.0, + "LookZ": -58.0, + "UpX": 0.0, + "UpY": 1.0, + "UpZ": 0.0 + }, + "ConnectorPins": [], + "NodeViews": [ + { + "Id": "f16400ac984e4818800d15aa324a0956", + "Name": "Point.ByCoordinates", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 404.79999999999995, + "Y": 194.00000000000006 + }, + { + "Id": "7556b378a2484190bb10ee4c5c8f89cc", + "Name": "Number", + "IsSetAsInput": false, + "IsSetAsOutput": false, + "Excluded": false, + "ShowGeometry": true, + "X": 2.0000000000001137, + "Y": 326.4000000000001 + } + ], + "Annotations": [], + "X": 28.600000000000023, + "Y": -12.400000000000091, + "Zoom": 1.0 + } +} \ No newline at end of file