| | 28 | def save (self, save_func): |
|---|
| | 29 | save_func('matrix', tuple(self.matrix)) |
|---|
| | 30 | for prop in ('orthogonal', 'horizontal'): |
|---|
| | 31 | save_func(prop, getattr(self, prop)) |
|---|
| | 32 | points = [ ] |
|---|
| | 33 | for h in self.handles(): |
|---|
| | 34 | points.append(tuple(map(float, h.pos))) |
|---|
| | 35 | save_func('points', points) |
|---|
| | 36 | |
|---|
| | 37 | def load (self, name, value): |
|---|
| | 38 | if name == 'matrix': |
|---|
| | 39 | self.matrix = eval(value) |
|---|
| | 40 | elif name == 'points': |
|---|
| | 41 | points = eval(value) |
|---|
| | 42 | for x in xrange(len(points) - 2): |
|---|
| | 43 | self.split_segment(0) |
|---|
| | 44 | for i, p in enumerate(points): |
|---|
| | 45 | self.handles()[i].pos = p |
|---|
| | 46 | elif name == 'horizontal': |
|---|
| | 47 | self.horizontal = eval(value) |
|---|
| | 48 | elif name == 'orthogonal': |
|---|
| | 49 | self._load_orthogonal = eval(value) |
|---|
| | 50 | |
|---|
| | 51 | def postload(self): |
|---|
| | 52 | if hasattr(self, '_load_orthogonal'): |
|---|
| | 53 | self.orthogonal = self._load_orthogonal |
|---|
| | 54 | del self._load_orthogonal |
|---|
| | 55 | |
|---|
| | 85 | def save(self, save_func): |
|---|
| | 86 | save_func('matrix', tuple(self.matrix)) |
|---|
| | 87 | save_func('width', self.width) |
|---|
| | 88 | save_func('height', self.height) |
|---|
| | 89 | |
|---|
| | 90 | def load(self, name, value): |
|---|
| | 91 | if name == 'matrix': |
|---|
| | 92 | self.matrix = eval(value) |
|---|
| | 93 | elif name == 'width': |
|---|
| | 94 | self.width = eval(value) |
|---|
| | 95 | elif name == 'height': |
|---|
| | 96 | self.height = eval(value) |
|---|
| | 97 | |
|---|
| | 98 | def postload(self): |
|---|
| | 99 | pass |
|---|
| | 100 | |
|---|
| | 129 | |
|---|
| | 130 | def save(self, save_func): |
|---|
| | 131 | save_func('matrix', tuple(self.matrix)) |
|---|
| | 132 | save_func('width', self.width) |
|---|
| | 133 | save_func('height', self.height) |
|---|
| | 134 | |
|---|
| | 135 | def load(self, name, value): |
|---|
| | 136 | if name == 'matrix': |
|---|
| | 137 | self.matrix = eval(value) |
|---|
| | 138 | elif name == 'width': |
|---|
| | 139 | self.width = eval(value) |
|---|
| | 140 | elif name == 'height': |
|---|
| | 141 | self.height = eval(value) |
|---|
| | 142 | |
|---|
| | 143 | def postload(self): |
|---|
| | 144 | pass |
|---|