summaryrefslogtreecommitdiff
path: root/src/main/python/shapes
diff options
context:
space:
mode:
authorBlaine2020-06-08 19:36:25 +0530
committerBlaine2020-06-08 19:36:25 +0530
commitad22f9ed828ec6ae2101950459a16f5f79e13ab0 (patch)
treeaf55025e9d8978e1f2fd024943501daf5176474c /src/main/python/shapes
parent82a30cddc6f268fe87237cf14b4c3f636cbe50c8 (diff)
downloadChemical-PFD-ad22f9ed828ec6ae2101950459a16f5f79e13ab0.tar.gz
Chemical-PFD-ad22f9ed828ec6ae2101950459a16f5f79e13ab0.tar.bz2
Chemical-PFD-ad22f9ed828ec6ae2101950459a16f5f79e13ab0.zip
serialization for scene items
Diffstat (limited to 'src/main/python/shapes')
-rw-r--r--src/main/python/shapes/line.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py
index 310b496..216c2b5 100644
--- a/src/main/python/shapes/line.py
+++ b/src/main/python/shapes/line.py
@@ -302,3 +302,14 @@ class Line(QGraphicsPathItem):
def setPenStyle(self, style):
"""change current pen style for line"""
self.penStyle = style
+
+ def __getstate__(self):
+ return {
+ "_classname_": self.__class__.__name__,
+ "startPoint": (self.startPoint.x(), self.startPoint.y()),
+ "endPoint": (self.endPoint.x(), self.endPoint.y()),
+ "points": [(point.x(), point.y()) for point in self.points]
+ }
+
+ def __setstate__(self, dict):
+ self.points = [QPointF(x, y) for x, y in dict["points"]] \ No newline at end of file