fsleyes.actions.saveoverlay¶
This module provides the SaveOverlayAction, which allows the user
to save the currently selected overlay. A couple of standalone functions are
defined in this module, which do the real work:
Saves the currently selected overlay (only if it is a |
|
Called by |
|
Returns |
-
class
fsleyes.actions.saveoverlay.SaveOverlayAction(overlayList, displayCtx, frame)[source]¶ Bases:
fsleyes.actions.base.ActionThe
SaveOverlayActionallows the user to save the currently selected overlay, if it has been edited, or only exists in memory.-
__init__(overlayList, displayCtx, frame)[source]¶ Create a
SaveOverlayAction.- Parameters
overlayList – The
OverlayList.displayCtx – The
DisplayContext.frame – The
FSLeyesFrame.
-
destroy()[source]¶ Removes listeners from the
DisplayContextandOverlayList, and callsAction.destroy().
-
_SaveOverlayAction__overlaySaveStateChanged(*a)¶ Called when the
Image.savedproperty of the currently selected overlay changes. Enables/disables thisSaveOverlayActionaccordingly.This is only applicable if the current overlay is a
Image- see the__selectedOverlayChanged()method.
-
_SaveOverlayAction__saveOverlay()¶ Called when this
Actionis executed. CallssaveOverlay()with the currently selected overlay.
-
_SaveOverlayAction__selectedOverlayChanged(*a)¶ Called when the selected overlay, or overlay list changes.
If the overlay is a
Image, and it has unsaved changes, this action is enabled; otherwise it is disabled.
-
__module__= 'fsleyes.actions.saveoverlay'¶
-
-
fsleyes.actions.saveoverlay.saveOverlay(overlay, display=None)[source]¶ Saves the currently selected overlay (only if it is a
Image), by a call toImage.save(). If adisplayis provided, theDisplay.namemay be updated to match the new overlay file name.- Parameters
overlay – The
Imageoverlay to savedisplay – The
Displayinstance associated with the overlay.
-
fsleyes.actions.saveoverlay.doSave(overlay, path=None)[source]¶ Called by
saveOverlay(). Tries to save the givenoverlayto the givenpath, and shows an error message if something goes wrong. ReturnsTrueif the save was successful,Falseotherwise.