-
Notifications
You must be signed in to change notification settings - Fork 638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Python script editing experience #8182
Conversation
|
This sounds amazing. THANK YOU!
…On Fri, Sep 15, 2017 at 3:17 PM Michael Dewberry ***@***.***> wrote:
Purpose
This PR makes some incremental improvements to the Python script editor
windows to address some common complaints and make writing, testing, and
iterating complex Python scripts a little bit easier.
These changes are primarily to the WPF UI around Python. It does not
change anything about how Python scripts are executed, but it does give the
user more control over when Python nodes are reexecuted.
- Allows the Python editor window to stay open
- Allows multiple Python editor windows to be open at once
- Makes the title of a Python editor window match the Python node's
title
- Adds a Run button to the Python editor to update the code, mark the
Python node changed and re-execute the downstream parts of the graph
This addresses the following issues in whole or in part:
#5137 <#5137> Python script
editor window titles should match node titles
#5076 <#5076> Add a Run button
to the Python script editor
#5068 <#5068> Allow multiple
Python script editors to be open at once
#3378 <https://github.com/DynamoDS/Dynamo/issues/3378> Python improvements
Declarations
Check these if you believe they are true
- [ X ] The code base is in a better state after this PR
- Is documented according to the standards
<https://github.com/DynamoDS/Dynamo/wiki/Coding-Standards>
- The level of testing this PR includes is appropriate
- [ X ] User facing strings, if any, are extracted into *.resx files
- All tests pass using the self-service CI.
- [ X ] Snapshot of UI changes, if any.
Reviewers FYIs
------------------------------
You can view, comment on, or merge this pull request online at:
#8182
Commit Summary
- Make Python script editor windows modeless and add Test button
- Merge branch 'master' of https://github.com/dynamods/dynamo into
pythonUX
- Change Python editor button wording, add icon to Run
- Close app cleanly when Python editor windows are open
- Refocus Python window after hitting run; trigger execution in Manual
mode
File Changes
- *M* src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml
<https://github.com/DynamoDS/Dynamo/pull/8182/files#diff-0> (76)
- *M* src/Libraries/PythonNodeModels/Properties/Resources.Designer.cs
<https://github.com/DynamoDS/Dynamo/pull/8182/files#diff-1> (13)
- *M* src/Libraries/PythonNodeModels/Properties/Resources.en-US.resx
<https://github.com/DynamoDS/Dynamo/pull/8182/files#diff-2> (7)
- *M* src/Libraries/PythonNodeModels/Properties/Resources.resx
<https://github.com/DynamoDS/Dynamo/pull/8182/files#diff-3> (7)
- *M* src/Libraries/PythonNodeModelsWpf/PythonNode.cs
<https://github.com/DynamoDS/Dynamo/pull/8182/files#diff-4> (31)
- *M* src/Libraries/PythonNodeModelsWpf/ScriptEditorWindow.xaml
<https://github.com/DynamoDS/Dynamo/pull/8182/files#diff-5> (29)
- *M* src/Libraries/PythonNodeModelsWpf/ScriptEditorWindow.xaml.cs
<https://github.com/DynamoDS/Dynamo/pull/8182/files#diff-6> (40)
Patch Links:
- https://github.com/DynamoDS/Dynamo/pull/8182.patch
- https://github.com/DynamoDS/Dynamo/pull/8182.diff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#8182>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFmaO-OfW0zz_KgbIBNAUhr8D8GkAjFQks5sis1VgaJpZM4PZZtR>
.
|
|
perfect!!!!!!!!!!!!!!!!!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Dewb thanks for these changes! I have some minor comments on name changes and one question.
| <value>Accept Changes</value> | ||
| <value>Save Changes</value> | ||
| </data> | ||
| <data name="PythonScriptEditorTestButton" xml:space="preserve"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we simply name this PythonScriptEditorRunButton as it is essentially the Run button for the Python script editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I changed the names of the buttons and decided not to change the underlying methods to make it clearer that it's a cosmetic change, but in hindsight changing the method names is definitely better for long-term maintenance.
| @@ -117,22 +122,37 @@ private void OnTextAreaTextEntered(object sender, TextCompositionEventArgs e) | |||
|
|
|||
| private void OnAcceptClicked(object sender, RoutedEventArgs e) | |||
| { | |||
| DialogResult = true; | |||
| UpdateScript(editText.Text); | |||
| this.Close(); | |||
| } | |||
|
|
|||
| private void OnCancelClicked(object sender, RoutedEventArgs e) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this to OnRevertClicked just so that the new intent is clearer or was Cancel doing the same thing before?
| nodeModel.OnNodeModified(); | ||
| } | ||
|
|
||
| private void OnTestClicked(object sender, RoutedEventArgs e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OnRunClicked?
| private void OnTestClicked(object sender, RoutedEventArgs e) | ||
| { | ||
| UpdateScript(editText.Text); | ||
| if (dynamoViewModel.HomeSpace.RunSettings.RunType != RunType.Automatic) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the Run button in the editor will have no effect unless the run mode in Dynamo is set to Automatic? Not sure if some users may expect this Run button to override the Dynamo mode setting and still execute the graph in manual Run mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we would expect it to do that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run always triggers a re-execution of the changes to the Python node. In automatic mode, it merely updates the script and marks the node as modified; automatic mode takes care of the rest. In manual or periodic mode, an execution is explicitly triggered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, sorry for some reason I read that the other way round; missed the !=. Thanks.
|
perhaps this might be better suited in a different PR or separate unit of work, but i'd like to make a suggestion since you're tackling the Python WPF side of things :
People have been asking for better de-bugging for a very long time and think this would satisfy at least some of the requests : As for implementation, the output of Python console could either be routed to the Dynamo console or I imagine a preview-like bubble underneath the editing window would work too (or within it, don't mind) - it would also go nicely together with that new Not long ago, I had a hacky prototype of Python console output being re-routed to a text file - so I know there's support in IronPython for this and it's doable. |
|
@radumg For sure. I went over the list of Python pain points and these seemed like the easiest/highest value. I hope to have some time to tackle the slightly trickier ones soon, and sending output to the Dynamo console is high on that list. |
|
@aparajit-pratap The last commit should address your review comments, apologies for not pinging you earlier. |
|
🎉 🎉 🎉 🎈 |
|
Thanks @Dewb! Merging ... |
Purpose
This PR makes some incremental improvements to the Python script editor windows to address some common complaints and make writing, testing, and iterating complex Python scripts a little bit easier.
These changes are primarily to the WPF UI around Python. It does not change anything about how Python scripts are executed, but it does give the user more control over when Python nodes are reexecuted.
This addresses the following issues in whole or in part:
#5137 Python script editor window titles should match node titles
#5076 Add a Run button to the Python script editor
#5068 Allow multiple Python script editors to be open at once
#3378 Python improvements
Declarations
Check these if you believe they are true
*.resxfilesReviewers
FYIs