fsleyes.panel¶
This module provides the FSLeyesPanel class.
A FSLeyesPanel object is a wx.Panel which provides some sort
of view of a collection of overlay objects, contained within an
OverlayList. The FSLeyesPanel is the base class for all GUI
panels in FSLeyes - see also the ViewPanel and ControlPanel
classes.
FSLeyesPanel instances are also ActionProvider instances - any
actions which are specified in the class definitions may (or may not) be
exposed to the user. Furthermore, any display configuration options which
should be made available available to the user can be added as
PropertyBase attributes of the FSLeyesPanel subclass.
Note
FSLeyesPanel instances are usually displayed within a
FSLeyesFrame, but they can be used on their own
as well. You will need to create, or need references to,
an OverlayList and a DisplayContext.
For example:
import fsleyes.overlay as ovl
import fsleyes.displaycontext as dc
import fsleyes.views.orthopanel as op
overlayList = ovl.OverlayList()
displayCtx = dc.DisplayContext(overlayList)
# the parent argument is some wx parent
# object such as a wx.Frame or wx.Panel.
# Pass in None as the FSLeyesFrame
orthoPanel = op.OrthoPanel(parent,
overlayList,
displayCtx,
None)
-
class
fsleyes.panel._FSLeyesPanel(overlayList, displayCtx, frame, kbFocus=False)[source]¶ Bases:
fsleyes.actions.ActionProvider,__main__.docbuilder.run.<locals>.MockClassThe
_FSLeyesPanelis the base class for theFSLeyesPaneland theFSLeyesToolBar.A
_FSLeyesPanelhas the following methods and properties, available for use by subclasses:Returns a unique name associated with this
_FSLeyesPanel.Returns the
FSLeyesFramewhich created this_FSLeyesPanel.Set the keyboard (tab, shift+tab) navigation order to the given list of controls, assumed to be children of this
_FSLeyesPanel.This method must be called by whatever is managing this
_FSLeyesPanelwhen it is to be closed/destroyed.Returns
Trueif a call todestroy()has been made,Falseotherwise.Note
When a
_FSLeyesPanelis no longer required, thedestroy()method must be called!-
__init__(overlayList, displayCtx, frame, kbFocus=False)[source]¶ Create a
_FSLeyesPanel.- Parameters
overlayList – A
OverlayListinstance.displayCtx – A
DisplayContextinstance.frame – The
FSLeyesFramethat created this_FSLeyesPanel. May beNone.kbFocus – If
True, a keyboard event handler is configured to interceptTabandShift+Tabkeyboard events, to shift focus between a set of child widgets. The child widgets to be included in the navigation can be specified with thesetNavOrder()method.
Set the keyboard (tab, shift+tab) navigation order to the given list of controls, assumed to be children of this
_FSLeyesPanel.
-
property
name¶ Returns a unique name associated with this
_FSLeyesPanel.
-
property
frame¶ Returns the
FSLeyesFramewhich created this_FSLeyesPanel. May beNone, if this panel was not created by aFSLeyesFrame.
-
destroy()[source]¶ This method must be called by whatever is managing this
_FSLeyesPanelwhen it is to be closed/destroyed.It seems to be impossible to define a single handler (on either the
wx.EVT_CLOSEand/orwx.EVT_WINDOW_DESTROYevents) which handles both cases where the window is destroyed (in the process of destroying a parent window), and where the window is explicitly closed by the user (e.g. when embedded as a page in a Notebook).This issue is probably caused by my use of the AUI framework for layout management, as the AUI manager/notebook classes do not seem to call close/destroy in all cases. Everything that I’ve tried, which relies upon
EVT_CLOSE/EVT_WINDOW_DESTROYevents, inevitably results in the event handlers not being called, or in segmentation faults (presumably due to double-frees at the C++ level).Subclasses which need to perform any cleaning up when they are closed may override this method, and should be able to assume that it will be called. So this method must be called by managing code when a panel is deleted.
Overriding subclass implementations must call this base class method, otherwise memory leaks will probably occur, and warnings will probably be output to the log (see
__del__()). This implememtation should be called after the subclass has performed its own clean-up, as this method expliciltly clears theoverlayListanddisplayCtxreferences (viaActionProvider.destroy()).
-
_FSLeyesPanel__onCharHook(ev)¶ Called on
EVT_CHAR_HOOKevents. Intercepts tab key presses, to force an explicit keyboard navigation ordering.
-
__module__= 'fsleyes.panel'¶
-
-
class
fsleyes.panel.FSLeyesPanel(parent, overlayList, displayCtx, frame, *args, **kwargs)[source]¶ Bases:
fsleyes.panel._FSLeyesPanel,__main__.docbuilder.run.<locals>.MockClassThe
FSLeyesPanelis the base class for all view and control panels in FSLeyes. See thefsleyesdocumentation for more details.See also the
ViewPanelandControlPanelclasses.-
__metaclass__= <MagicMock name='mock.siplib.wrappertype' id='4119440688'>¶
-
__init__(parent, overlayList, displayCtx, frame, *args, **kwargs)[source]¶ Create a
_FSLeyesPanel.- Parameters
overlayList – A
OverlayListinstance.displayCtx – A
DisplayContextinstance.frame – The
FSLeyesFramethat created this_FSLeyesPanel. May beNone.kbFocus – If
True, a keyboard event handler is configured to interceptTabandShift+Tabkeyboard events, to shift focus between a set of child widgets. The child widgets to be included in the navigation can be specified with thesetNavOrder()method.
-
__module__= 'fsleyes.panel'¶
-