Ticket #8599 (closed: fixed)
Improve GeneratePythonScript algorithm
Reported by: | Jay Rainey | Owned by: | Jay Rainey |
---|---|---|---|
Priority: | major | Milestone: | Release 3.1 |
Component: | Framework | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #7636 | Tester: | Peter Parker |
Description (last modified by Martyn Gigg) (diff)
Currently, GeneratePythonScript saves the algorithm history to a file. However, this should be improved and optionally allow for the content of the generatedScript to be returned, rather than a file that contains it's content.
This will be achieved by:
- Switch the action on the Filename Property from FileProperty::Save to FileProperty::OptionalSave
- Declare a new property that will store the contents of the file
declareProperty("ScriptText", "",Direction::Output)
- Add logic in exec() that will:
- Set the contents of the ScriptText property to the generated script
- Check if a value for the Filename property has been set. If it has then write the content to the file.
Change History
comment:3 Changed 7 years ago by Jay Rainey
- Status changed from new to inprogress
Make filename optional & add ScriptText property. Refs #8599.
Changeset: 5a126c0614dd0f1f02ed969cffcf76eb1ec91dad
comment:4 Changed 7 years ago by Jay Rainey
Updated unit test to verify ScriptText is correct. Refs #8599.
Changeset: ec75e47ae2a8418998877977c3ae41eed563430b
comment:5 Changed 7 years ago by Jay Rainey
Remove file error checking. Refs #8599.
Changeset: 9e620c25c53a33dc7b9b9869d3185857bcf9712b
comment:6 Changed 7 years ago by Jay Rainey
- Status changed from inprogress to verify
- Resolution set to fixed
comment:7 Changed 7 years ago by Jay Rainey
Only attempt to open file if property set. Refs #8599.
Changeset: 27eb18a3467adf49cd317aa585b999eb002a637e
comment:8 Changed 7 years ago by Jay Rainey
To test
- Verify that the build servers are not broken.
- Perform a code review.
- Load a workspace into Mantid. From the Script Interpreter call GeneratePythonScript against the workspace you loaded into Mantid. For example,
hist = GeneratePythonScript("MUSR00022725")
The history of the workspace should be saved into hist. Print the contents of hist to verify this.
- Ensure the saving functionality still works as before. Execute GeneratePythonScript from the Algorithm dialog interface. Select a workspace & an output location. Verify that the file is saved correctly. Alternatively, you could also test this in the script interpreter, such as:
GeneratePythonScript("MUSR00022725", "enter_a_valid_path")
comment:9 Changed 7 years ago by Peter Parker
- Status changed from verify to verifying
- Tester set to Peter Parker
comment:10 Changed 7 years ago by Peter Parker
- Status changed from verifying to closed
Merge remote-tracking branch 'origin/feature/8599_improve_python_hist_script'
Full changeset: fba37bce7abed81eef7d5b48bbede6fdf44ea03c
comment:11 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 9443