diff options
author | Blaine | 2020-06-09 20:59:54 +0530 |
---|---|---|
committer | Blaine | 2020-06-10 11:29:50 +0530 |
commit | 08344c77962dced303078c2cc798348278183daa (patch) | |
tree | c5dec33a05d93898dd0a45473a4e3db68db03f76 /src/main/python/shapes/shapes.py | |
parent | f4aac3c926ee71c18516442c0a2440c27d4dd7a3 (diff) | |
download | Chemical-PFD-08344c77962dced303078c2cc798348278183daa.tar.gz Chemical-PFD-08344c77962dced303078c2cc798348278183daa.tar.bz2 Chemical-PFD-08344c77962dced303078c2cc798348278183daa.zip |
implement labels and version info to saved file
Diffstat (limited to 'src/main/python/shapes/shapes.py')
-rw-r--r-- | src/main/python/shapes/shapes.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py index 774951d..9683d87 100644 --- a/src/main/python/shapes/shapes.py +++ b/src/main/python/shapes/shapes.py @@ -32,7 +32,16 @@ class ItemLabel(QGraphicsTextItem): def focusOutEvent(self, event): super(ItemLabel, self).focusOutEvent(event) self.setTextInteractionFlags(Qt.NoTextInteraction) + + def __getstate__(self): + return { + "text": self.toPlainText(), + "pos": (self.pos().x(), self.pos().y()) + } + def __setstate__(self, dict): + self.setPlainText(dict['text']) + self.setPos(*dict['pos']) class GripItem(QGraphicsPathItem): """ @@ -498,7 +507,8 @@ class NodeItem(QGraphicsSvgItem): "width": self.width, "height": self.height, "pos": (self.pos().x(), self.pos().y()), - "lineGripItems": [(hex(id(i)), i.m_index) for i in self.lineGripItems] + "lineGripItems": [(hex(id(i)), i.m_index) for i in self.lineGripItems], + "label": self.label } def __setstate__(self, dict): |