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)¶ Bases:
fsleyes.controls.controlpanel.ControlPanel
The
OverlayListPanel
displays all overlays in theOverlayList
, and allows the user to add, remove, and re-order overlays. AnOverlayListPanel
looks something like this: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 fewDisplayContext
properties: theDisplayContext.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 theDisplayContext.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)¶ 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 theListItemWidget
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
orFalse
. If this function returnsFalse
for an overlay, theListItemWidget
for that overlay will be disabled.
-
GetMinSize
()¶ 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 theOverlayListPanel
is calculated in__init__()
, and is fixed.
-
destroy
()¶ Must be called when this
OverlayListPanel
is no longer needed. Removes some property listeners, and callsControlPanel.destroy()
.
-
_OverlayListPanel__lbAdd
(ev)¶ Called when the add button on the list box is pressed. Calls the
loadoverlay.interactiveLoadOverlays()
method.
-
_OverlayListPanel__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..
-
_OverlayListPanel__lbMove
(ev)¶ Called when an overlay is moved in the
EditableListBox
. Reorders theDisplayContext.overlayOrder
to reflect the change.
-
_OverlayListPanel__lbRemove
(ev)¶ Called when an item is removed from the overlay listbox. Removes the corresponding overlay from the
OverlayList
.
-
_OverlayListPanel__lbSelect
(ev)¶ Called when an overlay is selected in the
EditableListBox
. Updates theDisplayContext.selectedOverlay
property.
-
_OverlayListPanel__overlayListChanged
(*a)¶ Called when the
OverlayList
changes. All of the items in the overlay list are re-created.
-
_OverlayListPanel__overlayNameChanged
(value, valid, display, propName)¶ Called when the
Display.name
of an overlay changes. Updates the corresponding label in the overlay list.
-
_OverlayListPanel__selectedOverlayChanged
(*a)¶ Called when the
DisplayContext.selectedOverlay
property changes. Updates the selected item in the list box.
-
__module__
= 'fsleyes.controls.overlaylistpanel'¶
-
-
class
fsleyes.controls.overlaylistpanel.
ListItemWidget
(parent, overlay, display, displayCtx, listBox, showVis=True, showGroup=True, showSave=True, propagateSelect=True)¶ Bases:
__main__.MockClass
A
LisItemWidget
is created by theOverlayListPanel
for every overlay in theOverlayList
. ALisItemWidget
contains controls which allow the user to:Toggle the visibility of the overlay (via the
Display.enabled
property)Add the overlay to a group (see the
DisplayContext.overlayGroups
property, and thegroup
module).Save the overlay (if it has been modified).
Note
While the
DisplayContext
allows multipleOverlayGroup
instances to be defined (and added to itsDisplayContext.overlayGroups
property), FSLeyes currently only defines a single group . ThisOverlayGroup
is created in thefsleyes.context()
function, and overlays can be added/removed to/from it via the lock button on aListItemWidget
. 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 isTrue
.
-
disabledFG
= '#888888'¶ This colour is used as the foreground (text) colour for overlays where their
Display.enabled
property isFalse
.
-
unsavedDefaultBG
= '#ffeeee'¶ This colour is used as the default background colour for
Image
overlays with anImage.saved
property ofFalse
.
-
unsavedSelectedBG
= '#ffcdcd'¶ This colour is used as the background colour for
Image
overlays with anImage.saved
property ofFalse
, when they are selected in theOverlayListPanel
.
-
__init__
(parent, overlay, display, displayCtx, listBox, showVis=True, showGroup=True, showSave=True, propagateSelect=True)¶ 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 thisListItemWidget
.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, theDisplayContext.selectedOverlay
is updated accordingly.
-
_ListItemWidget__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.
-
_ListItemWidget__onDestroy
(ev)¶ Called when this
ListItemWidget
is destroyed (i.e. when the associated overlay is removed from theOverlayListPanel
). Removes some proprety listeners from theDisplay
andOverlayGroup
instances, and from the overlay if it is anImage
instance.
-
_ListItemWidget__onLockButton
(ev)¶ Called when the lock button is pushed. Adds/removes the overlay to/from the
OverlayGroup
.
-
_ListItemWidget__onSaveButton
(ev)¶ Called when the save button is pushed. Calls the
Image.save()
method.
-
_ListItemWidget__onVisButton
(ev)¶ Called when the visibility button is pushed. Toggles the overlay visibility.
-
_ListItemWidget__overlayGroupChanged
(*a)¶ Called when the
OverlayGroup
changes. Updates the lock button based on whether the overlay associated with thisListItemWidget
is in the group or not.
-
_ListItemWidget__saveStateChanged
(*a)¶ If the overlay is an
Image
instance, this method is called when itsImage.saved
property changes. Updates the state of the save button.
-
__module__
= 'fsleyes.controls.overlaylistpanel'¶