napari_track_edit.application_menus.layer_dropdown ================================================== .. py:module:: napari_track_edit.application_menus.layer_dropdown Classes ------- .. autoapisummary:: napari_track_edit.application_menus.layer_dropdown.LayerDropdown Module Contents --------------- .. py:class:: LayerDropdown(viewer: napari.Viewer, layer_types: tuple, allow_none=False, exclude_types: tuple = (), follow_active: bool = True) Bases: :py:obj:`qtpy.QtWidgets.QComboBox` QComboBox widget with functions for updating the selected layer and to update the list of options when the list of layers is modified. :param viewer: the viewer whose layers are listed. :type viewer: napari.Viewer :param layer_types: the layer types to list. :type layer_types: tuple :param allow_none: whether to add a 'No selection' entry. Defaults to False. :type allow_none: bool :param exclude_types: layer types to leave out of the list. :type exclude_types: tuple :param follow_active: when True (the default), the dropdown follows the active layer in the viewer. Set to False to only change the selection when the user explicitly picks a layer from the dropdown. :type follow_active: bool .. py:attribute:: layer_changed .. py:attribute:: viewer .. py:attribute:: layer_types .. py:attribute:: exclude_types :value: () .. py:attribute:: allow_none :value: False .. py:attribute:: follow_active :value: True .. py:attribute:: selected_layer :value: None .. py:attribute:: _deleted :value: False .. py:attribute:: _rename_callbacks :type: dict[int, tuple[weakref.ref, callable]] .. py:method:: _watch_name(layer) -> bool Start tracking name changes of this layer, if it is one we list. :returns: True if the layer is listed (and is now watched), False otherwise. .. py:method:: _make_weak_rename_cb() Create a weak callback to track name updates but do not let the layer keep the widget alive forever. .. py:method:: _on_insert(event) -> None Update dropdown and make new layer responsive to name changes .. py:method:: _on_removed(event) -> None Disconnect signals and update dropdown when a layer is removed. .. py:method:: _on_selection_changed() Update the active layer when the selection changes .. py:method:: _update_dropdown(event=None) -> None Update the layers in the dropdown .. py:method:: set_layer_types(layer_types: tuple, exclude_types: tuple = ()) -> None Change which layer types are listed (and which to exclude) and refresh. .. py:method:: _emit_layer_changed() -> None Emit a signal holding the currently selected layer .. py:method:: _on_destroyed(*args) Disconnect everything cleanly