fsleyes.displaycontext.group
¶
This module provides the OverlayGroup
class, which allows
the display properties of one or more overlays to be linked.
-
class
fsleyes.displaycontext.group.
OverlayGroup
(displayCtx, overlayList)[source]¶ Bases:
__main__.docbuilder.run.<locals>.MockClass
An
OverlayGroup
is a group of overlays for which the correspondingDisplay
andDisplayOpts
properties are synchronised.The point of the
OverlayGroup
is to allow the user to define groups of overlays, so he/she can change display properties on the entire group, instead of having to change display properties on each overlay one by one.Overlays can be added to an
OverlayGroup
with theaddOverlay()
, and removed with theremoveOverlay()
.When an
OverlayGroup
is created, it dynamically adds all of the properties which could possibly be linked between overlays to itself, using theprops.HasProperties.addProperty()
method. When the first overlay is added to the group, these group properties are set to the display properties of this overlay. Then, the display properties of overlays which are subsequently added to the group will be set to the group display properties.Note
Currently, only a subset of display properties are linked between the overlays in a group. The properties which are linked are hard-coded in the
_groupBindings
dictionary.A possible future FSLeyes enhancement will be to allow the user to specify which display properties within an
OverlayGroup
should be linked.-
overlays
= <MagicMock name='mock.List()' id='139656530353984'>¶ The list of overlays in this
OverlayGroup
.Warning
Do not add/remove overlays directly to this list - use the
addOverlay()
andremoveOverlay()
methods instead.
-
_groupBindings
= <MagicMock name='mock.utils.typedict.TypeDict()' id='139656529198480'>¶ This dictionary defines the properties which are bound across
Display
instancesDisplayOpts
sub-class instances, for overlays which are in the same group.
-
__init__
(displayCtx, overlayList)[source]¶ Create an
OverlayGroup
.- Parameters
displayCtx – The
DisplayContext
.overlayList – The
OverlayList
.
-
__copy__
()[source]¶ Create a copy of this
OverlayGroup
.A custom copy operator is needed due to the way that the
props.HasProperties
class works.
-
destroy
()[source]¶ Must be called when this
OverlayGroup
is no longer needed. Removes all overlays from the group, and removes property listeners.
-
addOverlay
(overlay)[source]¶ Add an overlay to this
OverlayGroup
.If this is the first overlay to be added, the properties of this
OverlayGroup
are set to the overlay display properties. Otherwise, the overlay display properties are set to those of thisOverlayGroup
.
-
__bindDisplayOpts
(target, unbind=False)¶ Binds or unbinds the properties of the given
target
to the properties of thisOverlayGroup
.- Parameters
target – A
Display
orDisplayOpts
instance.unbind – Set to
True
to bind the properties,False
to unbind them.
-
__overlayListChanged
(*a)¶ Called when overlays are added/removed to/from the
OverlayList
. Makes sure that theoverlays
list for this group does not contain any overlays that have been removed.
-
__module__
= 'fsleyes.displaycontext.group'¶
-
__overlayTypeChanged
(value, valid, display, name)¶ This method is called when the
Display.overlayType
property for an overlay in the group changes.It makes sure that the display properties of the new
DisplayOpts
instance are bound to the group properties.
-