fsleyes.views.viewpanel¶
This module provides the ViewPanel class, which is the base-class
for all of the FSLeyes view panels. See the fsleyes package
documentation for more details.
-
class
fsleyes.views.viewpanel.ViewPanel(parent, overlayList, displayCtx, frame)¶ Bases:
fsleyes.panel.FSLeyesPanelThe
ViewPanelclass is the base-class for all FSLeyes views.A
ViewPaneldisplays some sort of view of the overlays in anOverlayList. The settings for aViewPanelare defined by aDisplayContextinstance.Panels and controls
A
ViewPanelclass uses awx.lib.agw.aui.AuiManagerto lay out its children. AViewPanelhas one central panel, which contains the primary view; and may have one or more secondary panels, which contain controls - see thecontrolspackage. The centre panel can be set via thecentrePanel()property, and secondary panels can be added/removed to/from with thetogglePanel()method. The current state of a secondary panel (i.e. whether one is open or not) can be queried with theisPanelOpen()method, and existing secondary panels can be accessed via thegetPanel()method. Secondary panels must be derived from either theControlPanelorControlToolBarbase-classes.Profiles
Some
ViewPanelclasses have relatively complex mouse and keyboard interaction behaviour (e.g. theOrthoPanelandLightBoxPanel). The logic defines this interaction is provided by aProfileinstance, and is managed by aProfileManager. SomeViewPanelclasses have multiple interaction profiles - for example, theOrthoPanelhas aviewprofile, and aneditprofile. The current interaction profile can be changed with theprofileproperty, and can be accessed with thegetCurrentProfile()method. See theprofilespackage for more information on interaction profiles.Programming interface
The following methods are available on a
Viewpanelfor programmatically controlling its display and layout:togglePanelAdd/remove the secondary panel of the specified type to/from this ViewPanel.isPanelOpenReturns Trueif a panel of typepanelTypeis open,Falseotherwise.getPanelIf an instance of panelTypeexists, it is returned.getPanelsReturns a list containing all control panels currently shown in this ViewPanel.getToolsThis method should be overridden by sub-classes (if necessary), and should return any actionmethods which should be added to theFSLeyesFrameTools menu.removeFromFrameRemove this ViewPanelfrom theFSLeyesFrame.removeAllPanelsRemove all control panels from this ViewPanel.getPanelInfoReturns the AuiPaneInfoobject which contains information about the given control panel.auiManagerReturns the wx.lib.agw.aui.AuiManagerobject which manages the layout of thisViewPanel.-
profile= <MagicMock name='mock.Choice()' id='139845843612560'>¶ The current interaction profile for this
ViewPanel.
-
__init__(parent, overlayList, displayCtx, frame)¶ Create a
ViewPanel. All arguments are passed through to theFSLeyesPanelconstructor.
-
destroy()¶ Removes some property listeners, destroys all child panels, destroys the
ProfileManager, andAuiManager, and callsFSLeyesPanel.destroy().
-
initProfile()¶ Must be called by subclasses, after they have initialised all of the attributes which may be needed by their associated
Profileinstances.
-
getCentrePanel= <MagicMock name='mock.deprecated()()' id='139845843667040'>¶
-
centrePanel¶ Returns the primary (centre) panel on this
ViewPanel.
-
setCentrePanel= <MagicMock name='mock.deprecated()()' id='139845843667040'>¶
-
togglePanel(panelType, *args, **kwargs)¶ Add/remove the secondary panel of the specified type to/from this
ViewPanel.Parameters: - panelType – Type of the secondary panel.
- args – All positional arguments are passed to the
panelTypeconstructor. - floatPane – If
True, the secondary panel is initially floated. Defaults toFalse. - floatOnly – If
True, andfloatPane=True, the panel will be permanently floated (i.e. it will not be dockable). - floatPos – If provided, and
floatPaneisTrue, specifies the location of the floating panel as(w, h)proportions between 0 and 1, relative to this view panel. - closeable – If
False, andfloatPane=True, the panel will not have a close button when it is floated. - location – If
floatPane=False, the initial dock position of the panel - eitherwx.TOP,wx.BOTTOM,wx.LEFT, orwx.RIGHT. Defaults to ``wx.BOTTOM. - title – Title to give the control. If not provided, it is
assumed that a title for
panelTypeis instrings.titles. - kwargs – All keyword arguments, apart from
floatPaneandlocation, are passed to thepanelTypeconstructor.
Note
The
panelTypetype must be a sub-class ofControlPanelorControlToolBar, which can be created like so:panel = panelType(parent, overlayList, displayCtx, frame, *args, **kwargs)
Warning
Do not define a control (a.k.a. secondary) panel constructor to accept arguments with the names
floatPane,floatOnly,floatPos,closeable, orlocation, as arguments with those names will get eaten by this method before they can be passed to the constructor.
-
isPanelOpen(panelType)¶ Returns
Trueif a panel of typepanelTypeis open,Falseotherwise.
-
getPanel(panelType)¶ If an instance of
panelTypeexists, it is returned. OtherwiseNoneis returned.
-
removeAllPanels()¶ Remove all control panels from this
ViewPanel.
-
removeFromFrame()¶ Remove this
ViewPanelfrom theFSLeyesFrame.Will raise an error if this
ViewPanelis not in aFSLeyesFrame.
-
getPanels()¶ Returns a list containing all control panels currently shown in this
ViewPanel.
-
getPanelInfo(panel)¶ Returns the
AuiPaneInfoobject which contains information about the given control panel.
-
auiManager¶ Returns the
wx.lib.agw.aui.AuiManagerobject which manages the layout of thisViewPanel.
-
getAuiManager= <MagicMock name='mock.deprecated()()' id='139845843667040'>¶
-
getTools()¶ This method should be overridden by sub-classes (if necessary), and should return any
actionmethods which should be added to theFSLeyesFrameTools menu.
-
_ViewPanel__auiMgrUpdate(*args, **kwargs)¶ Called whenever a panel is added/removed to/from this
ViewPanel.Calls the
Updatemethod on theAuiManagerinstance that is managing this panel.Parameters: newPanel – Must be passed as a keyword argument. When a new panel is added, it should be passed here.
-
_ViewPanel__configureProfile(*a)¶ Called by the
__selectedOverlayChanged()method. Implements the hacky logic described in the documentation for that method.
-
_ViewPanel__onPaneClose(ev=None, panel=None)¶ Called when the user closes a control (a.k.a. secondary) panel. Calls the
ControlPanel.destroy/ControlToolBar.destroymethod on the panel.
-
_ViewPanel__profileChanged(*a)¶ Called when the current
profileproperty changes. Tells theProfileManagerabout the change.The
ProfileManagerwill create a newProfileinstance of the appropriate type.
-
_ViewPanel__selectedOverlayChanged(*a)¶ Called when the
OverlayListorDisplayContext.selectedOverlaychanges.This method is slightly hard-coded and hacky. For the time being, profiles called
editprofiles are only supported forvolumeoverlay types. This method checks the type of the selected overlay, and disables theeditprofile option (if it is an option), so the user can only choose aneditprofile onvolumeoverlay types.
-
__module__= 'fsleyes.views.viewpanel'¶
-
-
fsleyes.views.viewpanel.AuiFloatingFrame__init__(*args, **kwargs)¶
-
fsleyes.views.viewpanel.AuiDockingGuide__init__(*args, **kwargs)¶