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.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)[source]¶ Create a
SaveOverlayAction
.- Parameters
overlayList – The
OverlayList
.displayCtx – The
DisplayContext
.frame – The
FSLeyesFrame
.
-
destroy
()[source]¶ Removes listeners from the
DisplayContext
andOverlayList
, and callsAction.destroy()
.
-
__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.
-
__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.
-
__saveOverlay
()¶ Called when this
Action
is executed. CallssaveOverlay()
with the currently selected overlay.
-
__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 adisplay
is provided, theDisplay.name
may be updated to match the new overlay file name.- Parameters
overlay – The
Image
overlay to savedisplay – The
Display
instance associated with the overlay.
-
fsleyes.actions.saveoverlay.
doSave
(overlay, path=None)[source]¶ 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.