fsleyes.actions.runscript¶
This module provides the RunScriptAction class, which allows
the user to run a custom Python script.
The following functions are used by the RunScriptAction, and are
available for other purposes:
runScriptCompiles and executes the given file, assumed to be a Python script. fsleyesScriptEnvironmentCreates and returns two dictionaries, to be used as the globalsandlocalsdictionaries when executing a custom FSLeyes python script.fsleyesShellHelpTextGenerates some help text that can be shown at the top of an interactive FSLLeyes shell.
-
class
fsleyes.actions.runscript.RunScriptAction(overlayList, displayCtx, frame)¶ Bases:
fsleyes.actions.base.ActionThe
RunScriptActionclass is anActuionwhich allows the user to run a custom Python script to control FSLeyes. The user is prompted to select a script, and then the script is compiled and exceuted.-
__init__(overlayList, displayCtx, frame)¶ Create a
RunScriptAction.Parameters: - overlayList – The
OverlayList. - displayCtx – The top-level
DisplayContext. - overlayList – The
FSLeyesFrame.
- overlayList – The
-
_RunScriptAction__doAction(script=None)¶ Called when this
Actionis invoked. If thescriptargument isNone, the user is prompted to select a script file. The script is then compiled and executed.
-
__module__= 'fsleyes.actions.runscript'¶
-
-
fsleyes.actions.runscript.runScript(frame, overlayList, displayCtx, script)¶ Compiles and executes the given file, assumed to be a Python script. An
Erroris raised if the script cannot be compiled or executed.
-
fsleyes.actions.runscript.fsleyesScriptEnvironment(frame, overlayList, displayCtx)¶ Creates and returns two dictionaries, to be used as the
globalsandlocalsdictionaries when executing a custom FSLeyes python script.
-
fsleyes.actions.runscript.fsleyesShellHelpText(_globals, _locals)¶ Generates some help text that can be shown at the top of an interactive FSLLeyes shell.