fsleyes.actions.togglecontrolpanel¶
This module provides the ToggleControlPanelAction class,
an action intended for use by ViewPanel classes to manage
the addition/removal of control panels.
-
class
fsleyes.actions.togglecontrolpanel.ToggleControlPanelAction(overlayList, displayCtx, viewPanel, cpType, func=None, name=None, **kwargs)[source]¶ Bases:
fsleyes.actions.base.ToggleActionThe
ToggleControlPanelActionclass is an action which is intended to augmentViewPanelactions which add/remove a control panel.The
ToggleControlPanelActionkeeps track of theViewPanelstate, and updates its ownToggleAction.toggledproperty whenever its designated control panel is added/removed from theViewPanel.This sounds a bit silly, but is necessary to ensure that any bound widgets (most likely menu items) are updated whenever the control panel managed by a
ToggleControlPanelActionis added/removed.-
__init__(overlayList, displayCtx, viewPanel, cpType, func=None, name=None, **kwargs)[source]¶ Create a
ToggleControlPanelAction.- Parameters
overlayList – The
OverlayListdisplayCtx – The
DisplayContextviewPanel – The
ViewPanelinstance.cpType – The type of the control panel being managed by this
ToggleControlPanelAction.func – The function which toggles the control panel. If not provided, a default function is used.
name – Name of this action - defaults to
func.__name__.
All other arguments will be passed to the
ViewPanel.togglePanel()method.
-
__togglePanel(*args, **kwargs)¶ Default action to run if a
funcwasn’t specified. CallsViewPanel.togglePanel,
-
destroy()[source]¶ Must be called when this
ToggleControlPanelActionis no longer used. Clears references, and calls the base-classdestroymethod.
-
__viewPanelChanged(*a)¶ Called whenever a control panel is added to/removed from the
ViewPanelthat owns thisToggleControlPanelAction. Updates theToggleAction.toggledattribute of this action.
-
__module__= 'fsleyes.actions.togglecontrolpanel'¶
-