VisHooks

VisHooks#

class braincell.vis.VisHooks(on_pick=None, on_hover=None, on_leave=None)[source]#

Bundle of interactive callbacks understood by the vis backends.

Hooks are optional; passing VisHooks() (the default) wires nothing. When any callback is set the backend takes an interactive path — for matplotlib that means enabling pick_event and/or motion_notify_event on the figure canvas; for PyVista it means calling pyvista.Plotter.enable_point_picking().

Parameters:
  • on_pick (Callable[[PickInfo], None] | None) – Called with a PickInfo whenever the user clicks a branch. Use this for “click to inspect” tooling.

  • on_hover (Callable[[PickInfo], None] | None) – Called with a PickInfo while the mouse hovers over a branch. Only delivered by the matplotlib backend at present; PyVista does not currently expose a hover event.

  • on_leave (Callable[[], None] | None) – Called with no arguments when the mouse moves off a branch after having hovered over it. Matplotlib only.

Notes

Callbacks are invoked synchronously from the event loop. Keep them cheap; heavy work belongs in a QueueTimer or async task.

is_active()[source]#

Return True if any callback is wired.

Return type:

bool