Ticket #7097 (closed: fixed)
Files downloaded from scriptrepo should be immediately usable in scripts
Reported by: | Nick Draper | Owned by: | Gesner Passos |
---|---|---|---|
Priority: | critical | Milestone: | Release 2.5.3 |
Component: | Mantid | Keywords: | PatchCandidate,Released |
Cc: | Blocked By: | ||
Blocking: | Tester: | Karl Palmen |
Description
We should automatically add the python directories for the script repository such that any library downloaded can immediately be used in a script in Mantidplot.
Change History
comment:4 Changed 7 years ago by Gesner Passos
Tester:
- Open ScriptRepository
- Download file: direct inelastic->SNS->MaskBTP.py
- Download file: direct inelastic->SNS->reduce_from_autoreduce_script.py
- Double-click file: reduce_from_autoreduce_script.py
- It will open the ScriptWindow
- Execute all
- At ISIS: it will execute till line 229, and them call exit. But, it was alive and it passed the line: 11, from MaskBTP import ... which means that this folder is inside the python path.
- Close MantidPlot.
- Restart MantidPlot
- try to execute the reduce_from_autoreduce_script again, and receive the same output.
comment:5 Changed 7 years ago by Gesner Passos
Add directories to the python.directories
This change makes the scripts available for the next time Mantid plot starts.
re #7097
Changeset: 7069e4f5a4cf9616c92c832f4ae099cc41fe7654
comment:6 Changed 7 years ago by Gesner Passos
Make script usable for the current session of Mantid
In order to make the script usable as soon as it is downloade, it is not enough to update the pythonscripts.directories as the last commit did, but you have also to add to the python sys path at the current running session.
Running python code is not possible inside the Framework/ScriptRepository level. So, a notification strategy was used in order to trigger a method of MantidUI, which can execute the python code that is necessary to add the new paths to the python sys.
re #7097
Changeset: 0877ae64abe5ebb2a83e0bfcde2d7422dea45f77
comment:7 Changed 7 years ago by Gesner Passos
Adjust the paths for windows backslashs
Adjust the strings to parse all the backslashes and make them normal slashes. Windows accept both kind, so, there is no problem of having them inside the pythondirectories.
re #7097
Changeset: 0cd17188659fc7f944579480b9a978abff007b75
comment:8 Changed 7 years ago by Gesner Passos
- Status changed from accepted to verify
- Resolution set to fixed
comment:9 Changed 7 years ago by Karl Palmen
- Status changed from verify to verifying
- Tester set to Karl Palmen
comment:10 Changed 7 years ago by Karl Palmen
I decided to use the default folder for the script repository, but the forgot what this was. It would be useful for this information (whatever folder the user chooses) to be displayed.
comment:11 Changed 7 years ago by Karl Palmen
MaskBTP.py found with aid of File explorer search. When I ran it, it ran quickly without any error messages or workspaces created ending on line 42.
comment:12 Changed 7 years ago by Karl Palmen
When I ran reduce_from_autoreduce_script.py, it exited with an attribute error on line 227. It appears to need arguments.
comment:13 Changed 7 years ago by Karl Palmen
Clicking on the file in the script repository window successfully opened script window with file in it after the script window was closed. However there was bad behaviour when one opens a 2nd or 3rd file by this method, which will be reported as a separate ticket.
Gesner confirmed it was OK for the reduce... script to work to line 227 (rather than 229).
comment:14 Changed 7 years ago by Karl Palmen
The reduce... script works in the same way in a second run of Mantid.
comment:16 Changed 7 years ago by Gesner Passos
Add directories to the python.directories
This change makes the scripts available for the next time Mantid plot starts.
re #7097
Changeset: 7069e4f5a4cf9616c92c832f4ae099cc41fe7654
comment:17 Changed 7 years ago by Gesner Passos
Make script usable for the current session of Mantid
In order to make the script usable as soon as it is downloade, it is not enough to update the pythonscripts.directories as the last commit did, but you have also to add to the python sys path at the current running session.
Running python code is not possible inside the Framework/ScriptRepository level. So, a notification strategy was used in order to trigger a method of MantidUI, which can execute the python code that is necessary to add the new paths to the python sys.
re #7097
Changeset: 0877ae64abe5ebb2a83e0bfcde2d7422dea45f77
comment:18 Changed 7 years ago by Gesner Passos
Adjust the paths for windows backslashs
Adjust the strings to parse all the backslashes and make them normal slashes. Windows accept both kind, so, there is no problem of having them inside the pythondirectories.
re #7097
Changeset: 0cd17188659fc7f944579480b9a978abff007b75
comment:19 Changed 7 years ago by Gesner Passos
Add directories to the python.directories
This change makes the scripts available for the next time Mantid plot starts.
re #7097
Changeset: 05e0aeccc81df4b0156c895790aae2c83f204250
comment:20 Changed 7 years ago by Gesner Passos
Make script usable for the current session of Mantid
In order to make the script usable as soon as it is downloade, it is not enough to update the pythonscripts.directories as the last commit did, but you have also to add to the python sys path at the current running session.
Running python code is not possible inside the Framework/ScriptRepository level. So, a notification strategy was used in order to trigger a method of MantidUI, which can execute the python code that is necessary to add the new paths to the python sys.
re #7097
Changeset: 6f53f2dc3d706b33f8f0bedb4cb9d3118c34db2a
comment:21 Changed 7 years ago by Gesner Passos
Adjust the paths for windows backslashs
Adjust the strings to parse all the backslashes and make them normal slashes. Windows accept both kind, so, there is no problem of having them inside the pythondirectories.
re #7097
Changeset: 938004fa3395303459fa052b45e3d6b6c1ac827e
comment:22 Changed 7 years ago by Nick Draper
- Keywords PatchCandidate,Released added; PatchCandidate removed
comment:23 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 7943