shapes: unlock before modifying during deepcopy

This commit is contained in:
Jan Petykiewicz 2019-12-13 21:16:43 -08:00
parent f2e6548d21
commit 25c9e591cb
6 changed files with 12 additions and 6 deletions

View File

@ -165,10 +165,11 @@ class Arc(Shape):
def __deepcopy__(self, memo: Dict = None) -> 'Arc': def __deepcopy__(self, memo: Dict = None) -> 'Arc':
memo = {} if memo is None else memo memo = {} if memo is None else memo
new = copy.copy(self) new = copy.copy(self).unlock()
new._offset = self._offset.copy() new._offset = self._offset.copy()
new._radii = self._radii.copy() new._radii = self._radii.copy()
new._angles = self._angles.copy() new._angles = self._angles.copy()
new.locked = self.locked
return new return new
def to_polygons(self, def to_polygons(self,

View File

@ -58,8 +58,9 @@ class Circle(Shape):
def __deepcopy__(self, memo: Dict = None) -> 'Circle': def __deepcopy__(self, memo: Dict = None) -> 'Circle':
memo = {} if memo is None else memo memo = {} if memo is None else memo
new = copy.copy(self) new = copy.copy(self).unlock()
new._offset = self._offset.copy() new._offset = self._offset.copy()
new.locked = self.locked
return new return new
def to_polygons(self, def to_polygons(self,

View File

@ -104,9 +104,10 @@ class Ellipse(Shape):
def __deepcopy__(self, memo: Dict = None) -> 'Ellipse': def __deepcopy__(self, memo: Dict = None) -> 'Ellipse':
memo = {} if memo is None else memo memo = {} if memo is None else memo
new = copy.copy(self) new = copy.copy(self).unlock()
new._offset = self._offset.copy() new._offset = self._offset.copy()
new._radii = self._radii.copy() new._radii = self._radii.copy()
new.locked = self.locked
return new return new
def to_polygons(self, def to_polygons(self,

View File

@ -171,11 +171,12 @@ class Path(Shape):
def __deepcopy__(self, memo: Dict = None) -> 'Path': def __deepcopy__(self, memo: Dict = None) -> 'Path':
memo = {} if memo is None else memo memo = {} if memo is None else memo
new = copy.copy(self) new = copy.copy(self).unlock()
new._offset = self._offset.copy() new._offset = self._offset.copy()
new._vertices = self._vertices.copy() new._vertices = self._vertices.copy()
new._cap = copy.deepcopy(self._cap, memo) new._cap = copy.deepcopy(self._cap, memo)
new._cap_extensions = copy.deepcopy(self._cap_extensions, memo) new._cap_extensions = copy.deepcopy(self._cap_extensions, memo)
new.locked = self.locked
return new return new
@staticmethod @staticmethod

View File

@ -91,9 +91,10 @@ class Polygon(Shape):
def __deepcopy__(self, memo: Dict = None) -> 'Polygon': def __deepcopy__(self, memo: Dict = None) -> 'Polygon':
memo = {} if memo is None else memo memo = {} if memo is None else memo
new = copy.copy(self) new = copy.copy(self).unlock()
new._offset = self._offset.copy() new._offset = self._offset.copy()
new._vertices = self._vertices.copy() new._vertices = self._vertices.copy()
new.locked = self.locked
return new return new
@staticmethod @staticmethod

View File

@ -94,9 +94,10 @@ class Text(Shape):
def __deepcopy__(self, memo: Dict = None) -> 'Text': def __deepcopy__(self, memo: Dict = None) -> 'Text':
memo = {} if memo is None else memo memo = {} if memo is None else memo
new = copy.copy(self) new = copy.copy(self).unlock()
new._offset = self._offset.copy() new._offset = self._offset.copy()
new._mirrored = copy.deepcopy(self._mirrored, memo) new._mirrored = copy.deepcopy(self._mirrored, memo)
new.locked = self.locked
return new return new
def to_polygons(self, def to_polygons(self,