77
88from ._private .arg_digestion import digest
99from .layers import Annotation , Layer
10+ from .scene_history import records_scene_history
1011
1112
1213class AnnotationsManager :
@@ -169,6 +170,7 @@ def summarize(record: dict[str, Any]) -> dict[str, Any]:
169170
170171 raise ValueError (f"No annotation record found for tag { tag !r} ." )
171172
173+ @records_scene_history
172174 @signal (tags = ["annotation" ])
173175 @digest ()
174176 def add_annotation (
@@ -229,10 +231,12 @@ def add_annotation(
229231 self ._view ._send ({"op" : "add_label" , "tag" : object_tag , "options" : options }) # noqa: SLF001
230232 return layer
231233
234+ @records_scene_history
232235 def add (self , * args , ** kwargs ) -> Layer :
233236 """Create an annotation; canonical manager alias for :meth:`add_annotation`."""
234237 return self .add_annotation (* args , ** kwargs )
235238
239+ @records_scene_history
236240 @signal (tags = ["annotation" ])
237241 @digest ()
238242 def add_label (
@@ -269,6 +273,7 @@ def add_label(
269273 skip_digestion = True ,
270274 )
271275
276+ @records_scene_history
272277 @signal (tags = ["annotation" , "selection" ])
273278 @digest ()
274279 def add_label_from_active_selection (
@@ -302,6 +307,7 @@ def add_label_from_active_selection(
302307 skip_digestion = True ,
303308 )
304309
310+ @records_scene_history
305311 @signal (tags = ["annotation" , "visibility" ])
306312 @digest ()
307313 def show (self , tag : str , skip_digestion : bool = False ) -> Layer :
@@ -310,6 +316,7 @@ def show(self, tag: str, skip_digestion: bool = False) -> Layer:
310316 layer .show (skip_digestion = True )
311317 return layer
312318
319+ @records_scene_history
313320 @signal (tags = ["annotation" , "visibility" ])
314321 @digest ()
315322 def hide (self , tag : str , skip_digestion : bool = False ) -> Layer :
@@ -318,13 +325,15 @@ def hide(self, tag: str, skip_digestion: bool = False) -> Layer:
318325 layer .hide (skip_digestion = True )
319326 return layer
320327
328+ @records_scene_history
321329 @signal (tags = ["annotation" ])
322330 @digest ()
323331 def delete (self , tag : str , skip_digestion : bool = False ) -> None :
324332 """Delete the annotation layer for ``tag``."""
325333 layer = self ._require_annotation_layer (tag )
326334 layer .delete (skip_digestion = True )
327335
336+ @records_scene_history
328337 @signal (tags = ["annotation" ])
329338 @digest ()
330339 def set_tag (self , tag : str , new_tag : str , skip_digestion : bool = False ) -> Layer :
@@ -333,6 +342,7 @@ def set_tag(self, tag: str, new_tag: str, skip_digestion: bool = False) -> Layer
333342 layer .set_tag (new_tag , skip_digestion = True )
334343 return layer
335344
345+ @records_scene_history
336346 @signal (tags = ["annotation" ])
337347 @digest ()
338348 def set_layer_tag (self , tag : str , new_layer_tag : str , skip_digestion : bool = False ) -> Layer :
@@ -341,6 +351,7 @@ def set_layer_tag(self, tag: str, new_layer_tag: str, skip_digestion: bool = Fal
341351 layer .set_layer_tag (new_layer_tag , skip_digestion = True )
342352 return layer
343353
354+ @records_scene_history
344355 @signal (tags = ["annotation" ])
345356 @digest ()
346357 def clear (self , tag : str | None = None , skip_digestion : bool = False ) -> None :
@@ -350,6 +361,7 @@ def clear(self, tag: str | None = None, skip_digestion: bool = False) -> None:
350361 return
351362 self .delete (tag , skip_digestion = True )
352363
364+ @records_scene_history
353365 @signal (tags = ["annotation" ])
354366 @digest ()
355367 def set_text (self , tag : str , text : str , skip_digestion : bool = False ) -> Layer :
@@ -376,6 +388,7 @@ def set_text(self, tag: str, text: str, skip_digestion: bool = False) -> Layer:
376388 )
377389 return layer
378390
391+ @records_scene_history
379392 @signal (tags = ["annotation" ])
380393 @digest ()
381394 def set_style (self , tag : str , style : dict [str , Any ], skip_digestion : bool = False ) -> Layer :
@@ -401,6 +414,7 @@ def set_style(self, tag: str, style: dict[str, Any], skip_digestion: bool = Fals
401414 )
402415 return layer
403416
417+ @records_scene_history
404418 @signal (tags = ["annotation" ])
405419 @digest ()
406420 def set_anchor (
@@ -442,6 +456,7 @@ def set_anchor(
442456 )
443457 return layer
444458
459+ @records_scene_history
445460 @signal (tags = ["annotation" ])
446461 @digest ()
447462 def set_group_index (self , tag : str , group_index : Any , skip_digestion : bool = False ) -> Layer :
0 commit comments