Stricter locking (lock contained ndarrays and turn lists into tuples)

This commit is contained in:
Jan Petykiewicz 2020-05-11 19:29:00 -07:00
commit c79eee2a8c
11 changed files with 88 additions and 9 deletions

View file

@ -77,7 +77,7 @@ class Text(Shape):
dose: float = 1.0,
locked: bool = False,
):
self.unlock()
object.__setattr__(self, 'locked', False)
self.identifier = ()
self.offset = offset
self.layer = layer
@ -243,3 +243,13 @@ def get_char_as_polygons(font_path: str,
polygons = path.to_polygons()
return polygons, advance
def lock(self) -> 'Text':
self.mirrored.flags.writeable = False
Shape.lock(self)
return self
def unlock(self) -> 'Text':
Shape.unlock(self)
self.mirrored.flags.writeable = True
return self