fsleyes.controls.overlaylistpanel

This module provides the OverlayListPanel, a FSLeyes control which displays a list of all overlays currently in the OverlayList.

class fsleyes.controls.overlaylistpanel.OverlayListPanel(parent, overlayList, displayCtx, frame, showVis=True, showGroup=True, showSave=True, propagateSelect=True, elistboxStyle=None, filterFunc=None)[source]

Bases: fsleyes.controls.controlpanel.ControlPanel

The OverlayListPanel displays all overlays in the OverlayList, and allows the user to add, remove, and re-order overlays. An OverlayListPanel looks something like this:

_images/overlaylistpanel.png

A ListItemWidget is displayed alongside every overlay in the list - this allows the user to enable/disable, group, and save each overlay.

The OverlayListPanel is closely coupled to a few DisplayContext properties: the DisplayContext.selectedOverlay property is linked to the currently selected item in the overlay list, and the order in which the overlays are shown is defined by the DisplayContext.overlayOrder property. This property is updated when the user changes the order of items in the list.

__init__(parent, overlayList, displayCtx, frame, showVis=True, showGroup=True, showSave=True, propagateSelect=True, elistboxStyle=None, filterFunc=None)[source]

Create an OverlayListPanel.

Parameters
  • parent – The wx parent object.

  • overlayList – An OverlayList instance.

  • displayCtx – A DisplayContext instance.

  • frame – The FSLeyesFrame instance.

  • showVis – If True (the default), a button will be shown alongside each overlay, allowing the user to toggle the overlay visibility.

  • showGroup – If True (the default), a button will be shown alongside each overlay, allowing the user to toggle overlay grouping.

  • showSave – If True (the default), a button will be shown alongside each overlay, allowing the user to save the overlay (if it is not saved).

  • propagateSelect – If True (the default), when the user interacts with the ListItemWidget for an overlay which is not the currently selected overlay, that overlay is updated to be the selected overlay.

  • elistboxStyle – Style flags passed through to the EditableListBox.

  • filterFunc – Function which must accept an overlay as its sole argument, and return True or False. If this function returns False for an overlay, the ListItemWidget for that overlay will be disabled.

GetMinSize()[source]

Returns the minimum size for this OverlayListPanel.

Under Linux/GTK, the wx.agw.lib.aui layout manager seems to arbitrarily adjust the minimum sizes of some panels. Therefore, The minimum size of the OverlayListPanel is calculated in __init__(), and is fixed.

destroy()[source]

Must be called when this OverlayListPanel is no longer needed. Removes some property listeners, and calls ControlPanel.destroy().

__selectedOverlayChanged(*a)

Called when the DisplayContext.selectedOverlay property changes. Updates the selected item in the list box.

__overlayNameChanged(value, valid, display, propName)

Called when the Display.name of an overlay changes. Updates the corresponding label in the overlay list.

__overlayListChanged(*a)

Called when the OverlayList changes. All of the items in the overlay list are re-created.

__lbMove(ev)

Called when an overlay is moved in the EditableListBox. Reorders the DisplayContext.overlayOrder to reflect the change.

__lbSelect(ev)

Called when an overlay is selected in the EditableListBox. Updates the DisplayContext.selectedOverlay property.

__lbAdd(ev)

Called when the add button on the list box is pressed. Calls the loadoverlay.interactiveLoadOverlays() method.

__lbRemove(ev)

Called when an item is removed from the overlay listbox. Removes the corresponding overlay from the OverlayList.

__lbDblClick(ev)

Called when an item label is double clicked on the overlay list box. Toggles the visibility of the overlay, via the Display.enabled property..

__module__ = 'fsleyes.controls.overlaylistpanel'
class fsleyes.controls.overlaylistpanel.ListItemWidget(parent, overlay, display, displayCtx, listBox, showVis=True, showGroup=True, showSave=True, propagateSelect=True)[source]

Bases: __main__.docbuilder.run.<locals>.MockClass

A LisItemWidget is created by the OverlayListPanel for every overlay in the OverlayList. A LisItemWidget contains controls which allow the user to:

Note

While the DisplayContext allows multiple OverlayGroup instances to be defined (and added to its DisplayContext.overlayGroups property), FSLeyes currently only defines a single group . This OverlayGroup is created in the fsleyes.context() function, and overlays can be added/removed to/from it via the lock button on a ListItemWidget. This functionality might change in a future version of FSLeyes.

Note

Currently, only Image overlays can be saved. The save button is disabled for all other overlay types.

enabledFG = '#000000'

This colour is used as the foreground (text) colour for overlays where their Display.enabled property is True.

disabledFG = '#888888'

This colour is used as the foreground (text) colour for overlays where their Display.enabled property is False.

unsavedDefaultBG = '#ffeeee'

This colour is used as the default background colour for Image overlays with an Image.saved property of False.

unsavedSelectedBG = '#ffcdcd'

This colour is used as the background colour for Image overlays with an Image.saved property of False, when they are selected in the OverlayListPanel.

__init__(parent, overlay, display, displayCtx, listBox, showVis=True, showGroup=True, showSave=True, propagateSelect=True)[source]

Create a ListItemWidget.

Parameters
  • parent – The wx parent object.

  • overlay – The overlay associated with this ListItemWidget.

  • display – The Display associated with the overlay.

  • displayCtx – The DisplayContext instance.

  • listBox – The EditableListBox that contains this ListItemWidget.

  • showVis – If True (the default), a button will be shown allowing the user to toggle the overlay visibility.

  • showGroup – If True (the default), a button will be shown allowing the user to toggle overlay grouping.

  • showSave – If True (the default), a button will be shown allowing the user to save the overlay (if it is not saved).

  • propagateSelect – If True (the default), when an overlay is selected in the list, the DisplayContext.selectedOverlay is updated accordingly.

__overlayGroupChanged(*a)

Called when the OverlayGroup changes. Updates the lock button based on whether the overlay associated with this ListItemWidget is in the group or not.

__onSaveButton(ev)

Called when the save button is pushed. Calls the Image.save() method.

__onLockButton(ev)

Called when the lock button is pushed. Adds/removes the overlay to/from the OverlayGroup.

__onVisButton(ev)

Called when the visibility button is pushed. Toggles the overlay visibility.

__module__ = 'fsleyes.controls.overlaylistpanel'
__displayVisChanged(*a)

Called when the Display.enabled property of the overlay changes. Updates the state of the enabled buton, and changes the item foreground colour.

__onDestroy(ev)

Called when this ListItemWidget is destroyed (i.e. when the associated overlay is removed from the OverlayListPanel). Removes some proprety listeners from the Display and OverlayGroup instances, and from the overlay if it is an Image instance.

__saveStateChanged(*a)

If the overlay is an Image instance, this method is called when its Image.saved property changes. Updates the state of the save button.