fsleyes.actions.applycommandline

This module provides the ApplyCommandLineAction class, an Action which allows the user to apply FSLeyes command line arguments to a CanvasPanel. The stand-alone applyCommandLineArgs() function is where the work is actually implemented.

class fsleyes.actions.applycommandline.ApplyCommandLineAction(overlayList, displayCtx, panel)

Bases: fsleyes.actions.base.Action

The ApplyCommandLineAction class is an Action which allows the user to apply FSLeyes command line arguments to a CanvasPanel.

__init__(overlayList, displayCtx, panel)

Create an ApplyCommandLineAction.

Parameters
_ApplyCommandLineAction__applyCommandLineArgs()

Called when this action is executed. Prompts the user to enter some command line arguments, and then passes them to the applyCommandLineArgs() function.

__module__ = 'fsleyes.actions.applycommandline'
exception fsleyes.actions.applycommandline.ApplyCLIExit(code, stdout, stderr)

Bases: Exception

Exception class raised by the applyCommandLineArgs() function.

__init__(code, stdout, stderr)

Initialize self. See help(type(self)) for accurate signature.

__str__()

Return str(self).

__module__ = 'fsleyes.actions.applycommandline'
__weakref__

list of weak references to the object (if defined)

fsleyes.actions.applycommandline.chdir(dest=None)

Context manager which temporarily changes to the specified dest directory, then restores the current directory afterwards.

If dest is None, the function yields without doing anything.

fsleyes.actions.applycommandline.applyCommandLineArgs(overlayList, displayCtx, argv, panel=None, applyOverlayArgs=True, baseDir=None, **kwargs)

Applies the command line arguments stored in argv to the CanvasPanel panel. If panel is None, it is assumed that argv only contains overlay arguments.

Parameters
  • overlayList – The OverlayList.

  • displayCtx – The DisplayContext. If a panel is provided, this should be the DisplayContext associated with that panel.

  • argv – List of command line arguments to apply.

  • panel – Optional CanvasPanel to apply the arguments to.

  • applyOverlayArgs – If False, overlay arguments are not applied.

  • baseDir – Directory from which to interpret the arguments, in case this is different from the current working directory, and overlays have been specified with relative paths.

All other keyword arguments are passed to the parseargs.applyOverlayArgs() function.