[Label / Ref / Grid] add raw constructors
This commit is contained in:
parent
8b7dd947fb
commit
46a15e2f0f
3 changed files with 52 additions and 0 deletions
|
|
@ -53,6 +53,22 @@ class Label(PositionableImpl, RepeatableImpl, AnnotatableImpl, Bounded, Pivotabl
|
|||
self.repetition = repetition
|
||||
self.annotations = annotations if annotations is not None else {}
|
||||
|
||||
@classmethod
|
||||
def _from_raw(
|
||||
cls,
|
||||
string: str,
|
||||
*,
|
||||
offset: NDArray[numpy.float64],
|
||||
repetition: Repetition | None = None,
|
||||
annotations: annotations_t | None = None,
|
||||
) -> Self:
|
||||
new = cls.__new__(cls)
|
||||
new._string = string
|
||||
new._offset = offset
|
||||
new._repetition = repetition
|
||||
new._annotations = annotations if annotations is not None else {}
|
||||
return new
|
||||
|
||||
def __copy__(self) -> Self:
|
||||
return type(self)(
|
||||
string=self.string,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue