Clean current instances and restore them from source dicts.
(self, raws:list)
| 11 | ''' A collection of ``Shape`` instances: ``Stroke`` or ``Fill``.''' |
| 12 | |
| 13 | def restore(self, raws:list): |
| 14 | '''Clean current instances and restore them from source dicts.''' |
| 15 | self.reset() |
| 16 | # Distinguish specified type by key like `start`, `end` and `uri`. |
| 17 | for raw in raws: |
| 18 | if 'start' in raw: |
| 19 | shape = Stroke(raw) |
| 20 | elif 'uri' in raw: |
| 21 | shape = Hyperlink(raw) |
| 22 | else: |
| 23 | shape = Fill(raw) |
| 24 | # add to list |
| 25 | self.append(shape) |
| 26 | return self |
| 27 | |
| 28 | |
| 29 | def _update_bbox(self, e:Shape): |