napari_track_edit.data_views.views.layers.click_utils

Attributes

QT_BUTTON_TO_INT

Functions

detect_side_button(→ int | None)

Detect if a mouse side button (back/forward) was pressed.

detect_click(→ collections.abc.Generator[None, None, bool])

Yield during drag, then return True if this was a click.

wait_for_release(→ collections.abc.Generator[None, ...)

Yield until the mouse button is released.

get_click_value(→ int)

Return the value (label, point index) at the click location

Module Contents

napari_track_edit.data_views.views.layers.click_utils.QT_BUTTON_TO_INT
napari_track_edit.data_views.views.layers.click_utils.detect_side_button(event: napari.utils.events.Event | qtpy.QtGui.QMouseEvent) → int | None

Detect if a mouse side button (back/forward) was pressed.

Parameters:

event – The napari mouse event or a Qt QMouseEvent

Returns:

back, 5: forward), or None if not a side button

Return type:

MouseButton integer (4

napari_track_edit.data_views.views.layers.click_utils.detect_click(event: napari.utils.events.Event) → collections.abc.Generator[None, None, bool]

Yield during drag, then return True if this was a click.

napari_track_edit.data_views.views.layers.click_utils.wait_for_release(event: napari.utils.events.Event) → collections.abc.Generator[None, None, None]

Yield until the mouse button is released.

Use this in a mouse drag callback before anything that may open a modal dialog (such as confirm_force_operation): a dialog opened while the button is still pressed takes the mouse release away from the canvas, which leaves napari and vispy in a ‘button pressed’ state and the viewer unresponsive to clicks.

napari_track_edit.data_views.views.layers.click_utils.get_click_value(layer: napari.layers.Labels | napari.layers.Points, event: napari.utils.events.Event) → int

Return the value (label, point index) at the click location