add raw arg, which skips setter funcs

This commit is contained in:
Jan Petykiewicz 2020-08-11 01:18:29 -07:00
parent 7ce601dc1d
commit f57ccc073d
5 changed files with 89 additions and 38 deletions

View File

@ -160,20 +160,32 @@ class Arc(Shape, metaclass=AutoSlots):
layer: layer_t = 0,
dose: float = 1.0,
repetition: Optional[Repetition] = None,
locked: bool = False):
locked: bool = False,
raw: bool = False,
):
object.__setattr__(self, 'locked', False)
self.identifier = ()
self.radii = radii
self.angles = angles
self.width = width
self.offset = offset
self.rotation = rotation
[self.mirror(a) for a, do in enumerate(mirrored) if do]
self.layer = layer
self.dose = dose
if raw:
self._radii = radii
self._angles = angles
self._width = width
self._offset = offset
self._rotation = rotation
self._repetition = repetition
self._layer = layer
self._dose = dose
else:
self.radii = radii
self.angles = angles
self.width = width
self.offset = offset
self.rotation = rotation
self.repetition = repetition
self.layer = layer
self.dose = dose
self.poly_num_points = poly_num_points
self.poly_max_arclen = poly_max_arclen
self.repetition = repetition
[self.mirror(a) for a, do in enumerate(mirrored) if do]
self.locked = locked
def __deepcopy__(self, memo: Dict = None) -> 'Arc':

View File

@ -95,18 +95,28 @@ class Ellipse(Shape, metaclass=AutoSlots):
layer: layer_t = 0,
dose: float = 1.0,
repetition: Optional[Repetition] = None,
locked: bool = False):
locked: bool = False,
raw: bool = False,
):
object.__setattr__(self, 'locked', False)
self.identifier = ()
self.radii = radii
self.offset = offset
self.rotation = rotation
if raw:
self._radii = radii
self._offset = offset
self._rotation = rotation
self._repetition = repetition
self._layer = layer
self._dose = dose
else:
self.radii = radii
self.offset = offset
self.rotation = rotation
self.repetition = repetition
self.layer = layer
self.dose = dose
[self.mirror(a) for a, do in enumerate(mirrored) if do]
self.layer = layer
self.dose = dose
self.poly_num_points = poly_num_points
self.poly_max_arclen = poly_max_arclen
self.repetition = repetition
self.locked = locked
def __deepcopy__(self, memo: Dict = None) -> 'Ellipse':

View File

@ -150,22 +150,32 @@ class Path(Shape, metaclass=AutoSlots):
dose: float = 1.0,
repetition: Optional[Repetition] = None,
locked: bool = False,
raw: bool = False,
):
object.__setattr__(self, 'locked', False)
self._cap_extensions = None # Since .cap setter might access it
self.identifier = ()
self.offset = offset
self.layer = layer
self.dose = dose
self.vertices = vertices
self.width = width
self.cap = cap
if cap_extensions is not None:
if raw:
self._vertices = vertices
self._offset = offset
self._repetition = repetition
self._layer = layer
self._dose = dose
self._width = width
self._cap = cap
self._cap_extensions = cap_extensions
else:
self.vertices = vertices
self.offset = offset
self.repetition = repetition
self.layer = layer
self.dose = dose
self.width = width
self.cap = cap
self.cap_extensions = cap_extensions
self.rotate(rotation)
[self.mirror(a) for a, do in enumerate(mirrored) if do]
self.repetition = repetition
self.locked = locked
def __deepcopy__(self, memo: Dict = None) -> 'Path':

View File

@ -78,16 +78,24 @@ class Polygon(Shape, metaclass=AutoSlots):
dose: float = 1.0,
repetition: Optional[Repetition] = None,
locked: bool = False,
raw: bool = False,
):
object.__setattr__(self, 'locked', False)
self.identifier = ()
self.layer = layer
self.dose = dose
self.vertices = vertices
self.offset = offset
if raw:
self._vertices = vertices
self._offset = offset
self._repetition = repetition
self._layer = layer
self._dose = dose
else:
self.vertices = vertices
self.offset = offset
self.repetition = repetition
self.layer = layer
self.dose = dose
self.rotate(rotation)
[self.mirror(a) for a, do in enumerate(mirrored) if do]
self.repetition = repetition
self.locked = locked
def __deepcopy__(self, memo: Optional[Dict] = None) -> 'Polygon':

View File

@ -68,18 +68,29 @@ class Text(RotatableImpl, Shape, metaclass=AutoSlots):
dose: float = 1.0,
repetition: Optional[Repetition] = None,
locked: bool = False,
raw: bool = False,
):
object.__setattr__(self, 'locked', False)
self.identifier = ()
self.offset = offset
self.layer = layer
self.dose = dose
self.string = string
self.height = height
self.rotation = rotation
if raw:
self._offset = offset
self._layer = layer
self._dose = dose
self._string = string
self._height = height
self._rotation = rotation
self._mirrored = mirrored
self._repetition = repetition
else:
self.offset = offset
self.layer = layer
self.dose = dose
self.string = string
self.height = height
self.rotation = rotation
self.mirrored = mirrored
self.repetition = repetition
self.font_path = font_path
self.mirrored = mirrored
self.repetition = repetition
self.locked = locked
def __deepcopy__(self, memo: Dict = None) -> 'Text':