summaryrefslogtreecommitdiff
path: root/src/main/python/shapes/shapes.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/python/shapes/shapes.py')
-rw-r--r--src/main/python/shapes/shapes.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index 2c6b072..9d26c7b 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):
"""
@@ -504,7 +513,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):