Skip to content
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

Add simpleapi import to GeneratePythonScript files #24719

Merged
merged 3 commits into from Feb 12, 2019

Conversation

ghost
Copy link

@ghost ghost commented Feb 7, 2019

Description of work.
Workbench does not import Mantid's simple API algorithms behind the scenes like MantidPlot, so 'from mantid.simpleapi import *' has been added to the top of scripts generated by the GeneratePythonScript algorithm to make them compatible.

Report to: [nobody].

To test:
Generate a script using the GeneratePythonScript algorithm in workbench and check it includes the import.

Fixes #24698.

This does not require release notes because workbench not yet released


Reviewer

Please comment on the following (full description):

Code Review
  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there are changes in the release notes then do they describe the changes appropriately?
Functional Tests
  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

'from mantid.simpleapi import *' is added to top of scripts
generated by GeneratePythonScript algorithm.
@ghost ghost added the GUI Issues and pull requests specific to the Mantid Workbench GUI. label Feb 7, 2019
@ghost ghost added this to the Release 3.14 (4.0?) milestone Feb 7, 2019
@ghost ghost added this to Under Review in Workbench via automation Feb 7, 2019
Pasarus
Pasarus previously requested changes Feb 7, 2019
@@ -133,6 +133,7 @@ void GeneratePythonScript::exec() {
"#Python Script Generated by GeneratePythonScript Algorithm\n";
generatedScript += "#########################################################"
"#############\n";
generatedScript += "from mantid.simpleapi import *\n";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to add an extra \n so that it has a proper separation between the import and the code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

@ghost ghost force-pushed the 24698_GeneratePythonScript_to_import_simpleapi branch from ceaa8f6 to 9496443 Compare February 11, 2019 10:54
@martyngigg martyngigg dismissed Pasarus’s stale review February 12, 2019 08:42

The changes requested have been applied but @Pasarus is away for a couple of days so lets not hold this up.

@SimonHeybrock SimonHeybrock merged commit 1749b2a into master Feb 12, 2019
Workbench automation moved this from Under Review to Closed Feb 12, 2019
@SimonHeybrock SimonHeybrock deleted the 24698_GeneratePythonScript_to_import_simpleapi branch February 12, 2019 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI Issues and pull requests specific to the Mantid Workbench GUI.
Projects
No open projects
Workbench
  
Closed
Development

Successfully merging this pull request may close these issues.

GeneratePythonScript - Update it to have from mantid.simpleapi import *
3 participants