codekingpro/portable-devtools
114k
1from abc import ABC2 3from ..constants import AnnotationFlag4from ..generic import NameObject, NumberObject5from ..generic._data_structures import DictionaryObject6 7 8class AnnotationDictionary(DictionaryObject, ABC):9 def __init__(self) -> None:10 super().__init__()11 12 from ..generic._base import NameObject # noqa: PLC041513 14 # /Rect should not be added here as Polygon and PolyLine can automatically set it15 self[NameObject("/Type")] = NameObject("/Annot")16 # The flags were NOT added to the constructor on purpose:17 # We expect that most users don't want to change the default.18 # If they do, they can use the property. The default is 0.19 20 @property21 def flags(self) -> AnnotationFlag:22 return AnnotationFlag(self.get(NameObject("/F"), 0))23 24 @flags.setter25 def flags(self, value: AnnotationFlag) -> None:26 self[NameObject("/F")] = NumberObject(value)27 28 29NO_FLAGS = AnnotationFlag(0)30 