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:
saveOverlay |
Saves the currently selected overlay (only if it is a Image), by a call to Image.save(). |
doSave |
Called by saveOverlay(). |
checkOverlaySaveState |
Returns True if all (compatible) overlays are saved to disk, False if there are any overlays with unsaved changes. |
-
class
fsleyes.actions.saveoverlay.SaveOverlayAction(overlayList, displayCtx, frame)¶ 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)¶ Create a
SaveOverlayAction.Parameters: - overlayList – The
OverlayList. - displayCtx – The
DisplayContext. - frame – The
FSLeyesFrame.
- overlayList – The
-
destroy()¶ 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 currentyl 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)¶ 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 save - display – The
Displayinstance associated with the overlay.
- overlay – The
-
fsleyes.actions.saveoverlay.doSave(overlay, path=None)¶ 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.
-
fsleyes.actions.saveoverlay.checkOverlaySaveState(overlayList, displayCtx)¶ Returns
Trueif all (compatible) overlays are saved to disk,Falseif there are any overlays with unsaved changes.