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)¶ Bases:
fsleyes.actions.ActionProvider
,__main__.MockClass
The
_FSLeyesPanel
is the base class for theFSLeyesPanel
and theFSLeyesToolBar
.A
_FSLeyesPanel
has the following methods and properties, available for use by subclasses:name
Returns a unique name associated with this _FSLeyesPanel
.frame
Returns the FSLeyesFrame
which created this_FSLeyesPanel
.overlayList
Returns a reference to the OverlayList
.displayCtx
Returns a reference to the DisplayContext
that is associated with this_FSLeyesPanel
.setNavOrder
Set the keyboard (tab, shift+tab) navigation order to the given list of controls, assumed to be children of this _FSLeyesPanel
.destroy
This method must be called by whatever is managing this _FSLeyesPanel
when it is to be closed/destroyed.destroyed
Returns True
if a call todestroy()
has been made,False
otherwise.Note
When a
_FSLeyesPanel
is no longer required, thedestroy()
method must be called!-
__init__
(overlayList, displayCtx, frame, kbFocus=False)¶ Create a
_FSLeyesPanel
.Parameters: - overlayList – A
OverlayList
instance. - displayCtx – A
DisplayContext
instance. - frame – The
FSLeyesFrame
that created this_FSLeyesPanel
. May beNone
. - kbFocus – If
True
, a keyboard event handler is configured to interceptTab
andShift+Tab
keyboard 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.
- overlayList – A
Set the keyboard (tab, shift+tab) navigation order to the given list of controls, assumed to be children of this
_FSLeyesPanel
.
-
name
¶ Returns a unique name associated with this
_FSLeyesPanel
.
-
frame
¶ Returns the
FSLeyesFrame
which created this_FSLeyesPanel
. May beNone
, if this panel was not created by aFSLeyesFrame
.
-
displayCtx
¶ Returns a reference to the
DisplayContext
that is associated with this_FSLeyesPanel
.
-
overlayList
¶ Returns a reference to the
OverlayList
.
-
_overlayList
¶ MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself.
If you use the spec or spec_set arguments then only magic methods that exist in the spec will be created.
Attributes and the return value of a MagicMock will also be MagicMocks.
-
_displayCtx
¶ MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself.
If you use the spec or spec_set arguments then only magic methods that exist in the spec will be created.
Attributes and the return value of a MagicMock will also be MagicMocks.
-
_name
¶ MagicMock is a subclass of Mock with default implementations of most of the magic methods. You can use MagicMock without having to configure the magic methods yourself.
If you use the spec or spec_set arguments then only magic methods that exist in the spec will be created.
Attributes and the return value of a MagicMock will also be MagicMocks.
-
getName
= <MagicMock name='mock.deprecated()()' id='4123138092'>¶
-
getFrame
= <MagicMock name='mock.deprecated()()' id='4123138092'>¶
-
getDisplayContext
= <MagicMock name='mock.deprecated()()' id='4123138092'>¶
-
getOverlayList
= <MagicMock name='mock.deprecated()()' id='4123138092'>¶
-
destroy
()¶ This method must be called by whatever is managing this
_FSLeyesPanel
when it is to be closed/destroyed.It seems to be impossible to define a single handler (on either the
wx.EVT_CLOSE
and/orwx.EVT_WINDOW_DESTROY
events) 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_DESTROY
events, 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 the__overlayList
and__displayCtx
references.
-
_FSLeyesPanel__onCharHook
(ev)¶ Called on
EVT_CHAR_HOOK
events. Intercepts tab key presses, to force an explicit keyboard navigation ordering.
-
__module__
= 'fsleyes.panel'¶
-
-
fsleyes.panel.
FSLeyesPanelMeta
¶ alias of
builtins.type
-
fsleyes.panel.
FSLeyesPanelBase
¶ alias of
__main__.docbuilder.run.<locals>.MockClass
-
class
fsleyes.panel.
FSLeyesPanel
(parent, overlayList, displayCtx, frame, *args, **kwargs)¶ Bases:
fsleyes.panel._FSLeyesPanel
,__main__.MockClass
The
FSLeyesPanel
is the base class for all view and control panels in FSLeyes. See thefsleyes
documentation for more details.See also the
ViewPanel
andControlPanel
classes.-
__init__
(parent, overlayList, displayCtx, frame, *args, **kwargs)¶ Create a
_FSLeyesPanel
.Parameters: - overlayList – A
OverlayList
instance. - displayCtx – A
DisplayContext
instance. - frame – The
FSLeyesFrame
that created this_FSLeyesPanel
. May beNone
. - kbFocus – If
True
, a keyboard event handler is configured to interceptTab
andShift+Tab
keyboard 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.
- overlayList – A
-
__module__
= 'fsleyes.panel'¶
-
-
class
fsleyes.panel.
FSLeyesSettingsPanel
¶ Bases:
fsleyes.panel.FSLeyesPanel
The
FSLeyesSettingsPanel
is deprecated - it has been replaced with thecontrols.controlpanel.SettingsPanel
.-
__module__
= 'fsleyes.panel'¶
-
__init__
= <MagicMock name='mock.deprecated()()' id='4123138092'>¶
-
getWidgetList
()¶
-