movement.napari.layer_wiring#

Description

Layer callbacks that must outlive the widget connecting them.

Put a callback here if it should be active as long as the viewer or a layer exists (rather than sharing lifetime with a widget that can be closed).

  • Typical candidates are callbacks that mutate layer state (data, properties, symbols, editable): that state is part of the user’s work and may be saved to a file later, so it must survive the widget being closed.

  • A callback that only refreshes a widget’s own UI (a dropdown, a table, a button) can stay a method on that widget: once the widget is gone there is nothing left to update, which is fine.

Functions

active_movement_points_layer

Return the active movement Points layer, else the last one, else None.

connect_viewer_callbacks

Wire the layer callbacks to a viewer, skipping if already wired.

frame_axis_is_sliced

Determine whether the frame axis is the sliced axis in a 2D view.

is_movement_points_layer

Return True for a movement-loaded napari Points layer.

on_points_data_changed

Keep the corresponding Tracks layer in sync with the Points layer.

remove_from_tracks_layer

Remove the rows corresponding to deleted points.

set_point_symbol_by_edited

Show points flagged as edited with a distinct marker symbol.

set_tracks_layer_data

Set a Tracks layer's data and properties, preserving color_by.

sync_tracks_layer

Update the corresponding Tracks layer to match an edited point.

update_frame_slider_range

Widen the frame slider range to cover NaN-trimmed frames.

update_points_layers_editable

Disable point editing while the frame axis isn't sliced.