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, layer: layer_t = 0,
dose: float = 1.0, dose: float = 1.0,
repetition: Optional[Repetition] = None, repetition: Optional[Repetition] = None,
locked: bool = False): locked: bool = False,
raw: bool = False,
):
object.__setattr__(self, 'locked', False) object.__setattr__(self, 'locked', False)
self.identifier = () self.identifier = ()
self.radii = radii if raw:
self.angles = angles self._radii = radii
self.width = width self._angles = angles
self.offset = offset self._width = width
self.rotation = rotation self._offset = offset
[self.mirror(a) for a, do in enumerate(mirrored) if do] self._rotation = rotation
self.layer = layer self._repetition = repetition
self.dose = dose 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_num_points = poly_num_points
self.poly_max_arclen = poly_max_arclen self.poly_max_arclen = poly_max_arclen
self.repetition = repetition [self.mirror(a) for a, do in enumerate(mirrored) if do]
self.locked = locked self.locked = locked
def __deepcopy__(self, memo: Dict = None) -> 'Arc': def __deepcopy__(self, memo: Dict = None) -> 'Arc':

View File

@ -95,18 +95,28 @@ class Ellipse(Shape, metaclass=AutoSlots):
layer: layer_t = 0, layer: layer_t = 0,
dose: float = 1.0, dose: float = 1.0,
repetition: Optional[Repetition] = None, repetition: Optional[Repetition] = None,
locked: bool = False): locked: bool = False,
raw: bool = False,
):
object.__setattr__(self, 'locked', False) object.__setattr__(self, 'locked', False)
self.identifier = () self.identifier = ()
self.radii = radii if raw:
self.offset = offset self._radii = radii
self.rotation = rotation 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.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_num_points = poly_num_points
self.poly_max_arclen = poly_max_arclen self.poly_max_arclen = poly_max_arclen
self.repetition = repetition
self.locked = locked self.locked = locked
def __deepcopy__(self, memo: Dict = None) -> 'Ellipse': def __deepcopy__(self, memo: Dict = None) -> 'Ellipse':

View File

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

View File

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

View File

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