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.Action
The
SaveOverlayAction
allows 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
DisplayContext
andOverlayList
, and callsAction.destroy()
.
-
_SaveOverlayAction__overlaySaveStateChanged
(*a)¶ Called when the
Image.saved
property of the currently selected overlay changes. Enables/disables thisSaveOverlayAction
accordingly.This is only applicable if the current overlay is a
Image
- see the__selectedOverlayChanged()
method.
-
_SaveOverlayAction__saveOverlay
()¶ Called when this
Action
is 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 adisplay
is provided, theDisplay.name
may be updated to match the new overlay file name.Parameters: - overlay – The
Image
overlay to save - display – The
Display
instance associated with the overlay.
- overlay – The
-
fsleyes.actions.saveoverlay.
doSave
(overlay, path=None)¶ Called by
saveOverlay()
. Tries to save the givenoverlay
to the givenpath
, and shows an error message if something goes wrong. ReturnsTrue
if the save was successful,False
otherwise.
-
fsleyes.actions.saveoverlay.
checkOverlaySaveState
(overlayList, displayCtx)¶ Returns
True
if all (compatible) overlays are saved to disk,False
if there are any overlays with unsaved changes.