Python engine property should copy/paste and undo correctly.#11006
Python engine property should copy/paste and undo correctly.#11006mjkkirschner merged 8 commits intoDynamoDS:masterfrom
Conversation
python node update valure core can handle engine python nodeview right click uses umv commands
…irst test case as well as subsequent tests.
| { | ||
| libraries.Add("DSCPython.dll"); | ||
| libraries.Add("DSIronPython.dll"); | ||
| base.Start(); |
There was a problem hiding this comment.
Can you remind me what does base.Start() do?
There was a problem hiding this comment.
a bunch of stuff, it basically starts the DynamoModel, and in this case the View as well.
| Assert.AreEqual(new List<string> { "2.7.9", "3.8.3" }, pynode2.CachedValue.GetElements().Select(x => x.Data)); | ||
| DispatcherUtil.DoEvents(); | ||
| Model.CurrentWorkspace.Undo(); | ||
| Assert.AreEqual(new List<string> { "3.8.3", "3.8.3" }, pynode2.CachedValue.GetElements().Select(x => x.Data)); |
QilongTang
left a comment
There was a problem hiding this comment.
Thank you for adding tests for the other newly supported commands within this PR. Looks good to me
| element.AppendChild(script); | ||
| XmlElement engine = element.OwnerDocument.CreateElement(nameof(Engine)); | ||
| engine.InnerText = Enum.GetName(typeof(PythonEngineVersion), Engine); | ||
| element.AppendChild(engine); |
There was a problem hiding this comment.
Seems these can still be easily converted to use Json in the future
There was a problem hiding this comment.
Agreed. The fact that there are things in Dynamo depending on XML serialization, when we have obsoleted it, is scary.
There was a problem hiding this comment.
I will file a task to do a spike on this, I believe we did one way back when we looked at JSON originally, maybe I can dig up some notes.
mmisol
left a comment
There was a problem hiding this comment.
Added some minor comments. Looks good overall
| nodeLogic.IsSetAsInput = value; | ||
| RaisePropertyChanged("IsSetAsInput"); | ||
| DynamoViewModel.ExecuteCommand( | ||
| new DynamoModel.UpdateModelValueCommand( |
There was a problem hiding this comment.
Can you check formatting here? If this was Python the statement would be outside the if :)
| nodeLogic.IsSetAsOutput = value; | ||
| RaisePropertyChanged("IsSetAsOutput"); | ||
| DynamoViewModel.ExecuteCommand( | ||
| new DynamoModel.UpdateModelValueCommand( |
| RaisePropertyChanged("IsDisplayingLabels"); | ||
|
|
||
| DynamoViewModel.ExecuteCommand( | ||
| new DynamoModel.UpdateModelValueCommand( |
There was a problem hiding this comment.
yeah, I'm not sure why that is, I didn't touch it because it didn't exist before and was present for those other properties - I can make the change and see if there are any test failures if you would like.
There was a problem hiding this comment.
I guess it would be more consistent but not really required. Your call
| element.AppendChild(script); | ||
| XmlElement engine = element.OwnerDocument.CreateElement(nameof(Engine)); | ||
| engine.InnerText = Enum.GetName(typeof(PythonEngineVersion), Engine); | ||
| element.AppendChild(engine); |
There was a problem hiding this comment.
Agreed. The fact that there are things in Dynamo depending on XML serialization, when we have obsoleted it, is scary.
test/DynamoCoreTests/CoreTests.cs
Outdated
|
|
||
| [Test] | ||
| [Category("UnitTests")] | ||
| public void CanCopydAndPasteAndUndoShowLabels() |
There was a problem hiding this comment.
Typo Copyd => Copy. I see this is consistently copied over to other tests.
…S#11006) merging this in and will cp to 2.8
Purpose
https://jira.autodesk.com/browse/DYN-3022
Some properties of nodeModel cannot be undone using
undo/redoand do notcopy/pastecorrectly. This includes the new Engine property on Python nodes.This PR does the following:
adds xml serialization and deserialization of the missing properties to
NodeModelandPythonNodeModelclasses, as the undo redo recorder and copy/paste rely on legacy xml model serialization.adds cases for the
updateModelValuecommand handler on NodeModel to handle the properties we want to be undoable.in the viewModel layer - anywhere we wish to have undoable property settings, we use a
UpdateModelValueCommandto set the property, these are automatically serialized into the undo/redo recorder.tests are added for the nodeModel properties, and for the Python engine properties.
Fix a small issue with the PythonNodeViewCustmizationTests and when the python engines were being scanned for to update the available engines.
Declarations
Check these if you believe they are true
*.resxfiles