add toggle visibliity to layer actions
@@ -97,6 +97,11 @@ def _merge_stack(ll: LayerList, rgb=False):
ll.append(new)
+def _toggle_visibility(ll: LayerList):
+ for lay in ll.selection:
+ lay.visible = not lay.visible
+
+
def _select_linked_layers(ll: LayerList):
ll.selection.update(get_linked_layers(*ll.selection))
@@ -187,6 +192,12 @@ _LAYER_ACTIONS: Sequence[MenuItem] = [
'enable_when': 'only_labels_selected',
'show_when': 'True',
},
+ 'napari:toggle_visibility': {
+ 'description': trans._('Toggle visibility'),
+ 'action': _toggle_visibility,
+ 'enable_when': 'True',
+ 'show_when': 'True',
+ },
},
# (each new dict creates a seperated section in the menu)
{
