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.ControlPanelThe
OverlayListPaneldisplays all overlays in theOverlayList, and allows the user to add, remove, and re-order overlays. AnOverlayListPanellooks something like this:
A
ListItemWidgetis displayed alongside every overlay in the list - this allows the user to enable/disable, group, and save each overlay.The
OverlayListPanelis closely coupled to a fewDisplayContextproperties: theDisplayContext.selectedOverlayproperty is linked to the currently selected item in the overlay list, and the order in which the overlays are shown is defined by theDisplayContext.overlayOrderproperty. 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
wxparent object.overlayList – An
OverlayListinstance.displayCtx – A
DisplayContextinstance.frame – The
FSLeyesFrameinstance.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 theListItemWidgetfor 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
TrueorFalse. If this function returnsFalsefor an overlay, theListItemWidgetfor that overlay will be disabled.
-
GetMinSize()[source]¶ Returns the minimum size for this
OverlayListPanel.Under Linux/GTK, the
wx.agw.lib.auilayout manager seems to arbitrarily adjust the minimum sizes of some panels. Therefore, The minimum size of theOverlayListPanelis calculated in__init__(), and is fixed.
-
destroy()[source]¶ Must be called when this
OverlayListPanelis 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.enabledproperty..
-
_OverlayListPanel__lbMove(ev)¶ Called when an overlay is moved in the
EditableListBox. Reorders theDisplayContext.overlayOrderto 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.selectedOverlayproperty.
-
_OverlayListPanel__overlayListChanged(*a)¶ Called when the
OverlayListchanges. All of the items in the overlay list are re-created.
-
_OverlayListPanel__overlayNameChanged(value, valid, display, propName)¶ Called when the
Display.nameof an overlay changes. Updates the corresponding label in the overlay list.
-
_OverlayListPanel__selectedOverlayChanged(*a)¶ Called when the
DisplayContext.selectedOverlayproperty 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)[source]¶ Bases:
__main__.MockClassA
LisItemWidgetis created by theOverlayListPanelfor every overlay in theOverlayList. ALisItemWidgetcontains controls which allow the user to:Toggle the visibility of the overlay (via the
Display.enabledproperty)Add the overlay to a group (see the
DisplayContext.overlayGroupsproperty, and thegroupmodule).Save the overlay (if it has been modified).
Note
While the
DisplayContextallows multipleOverlayGroupinstances to be defined (and added to itsDisplayContext.overlayGroupsproperty), FSLeyes currently only defines a single group . ThisOverlayGroupis 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
Imageoverlays 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.enabledproperty isTrue.
-
disabledFG= '#888888'¶ This colour is used as the foreground (text) colour for overlays where their
Display.enabledproperty isFalse.
-
unsavedDefaultBG= '#ffeeee'¶ This colour is used as the default background colour for
Imageoverlays with anImage.savedproperty ofFalse.
-
unsavedSelectedBG= '#ffcdcd'¶ This colour is used as the background colour for
Imageoverlays with anImage.savedproperty ofFalse, when they are selected in theOverlayListPanel.
-
__init__(parent, overlay, display, displayCtx, listBox, showVis=True, showGroup=True, showSave=True, propagateSelect=True)[source]¶ Create a
ListItemWidget.- Parameters
parent – The
wxparent object.overlay – The overlay associated with this
ListItemWidget.display – The
Displayassociated with the overlay.displayCtx – The
DisplayContextinstance.listBox – The
EditableListBoxthat 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.selectedOverlayis updated accordingly.
-
_ListItemWidget__displayVisChanged(*a)¶ Called when the
Display.enabledproperty of the overlay changes. Updates the state of the enabled buton, and changes the item foreground colour.
-
_ListItemWidget__onDestroy(ev)¶ Called when this
ListItemWidgetis destroyed (i.e. when the associated overlay is removed from theOverlayListPanel). Removes some proprety listeners from theDisplayandOverlayGroupinstances, and from the overlay if it is anImageinstance.
-
_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
OverlayGroupchanges. Updates the lock button based on whether the overlay associated with thisListItemWidgetis in the group or not.
-
_ListItemWidget__saveStateChanged(*a)¶ If the overlay is an
Imageinstance, this method is called when itsImage.savedproperty changes. Updates the state of the save button.
-
__module__= 'fsleyes.controls.overlaylistpanel'¶