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:

runScript

Compiles and executes the given file, assumed to be a Python script.

fsleyesScriptEnvironment

Creates and returns two dictionaries, to be used as the globals and locals dictionaries when executing a custom FSLeyes python script.

fsleyesShellHelpText

Generates some help text that can be shown at the top of an interactive FSLLeyes shell.

class fsleyes.actions.runscript.RunScriptAction(*args, **kwargs)[source]

Bases: Action

The RunScriptAction class is an Actuion which 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)[source]

Create a RunScriptAction.

Parameters:
__doAction(script=None)

Called when this Action is invoked. If the script argument is None, the user is prompted to select a script file. The script is then compiled and executed.

__annotations__ = {}
__module__ = 'fsleyes.actions.runscript'
fsleyes.actions.runscript.runScript(frame, overlayList, displayCtx, script)[source]

Compiles and executes the given file, assumed to be a Python script. An Error is raised if the script cannot be compiled or executed.

fsleyes.actions.runscript.fsleyesScriptEnvironment(frame, overlayList, displayCtx)[source]

Creates and returns two dictionaries, to be used as the globals and locals dictionaries when executing a custom FSLeyes python script.

fsleyes.actions.runscript.fsleyesShellHelpText(_globals, _locals)[source]

Generates some help text that can be shown at the top of an interactive FSLLeyes shell.