summaryrefslogtreecommitdiff
path: root/src/main/python/shapes
diff options
context:
space:
mode:
authorBlaine2020-06-08 19:36:25 +0530
committerBlaine2020-06-08 20:04:17 +0530
commit4eaa5eacee5778f290577eb63cbae163a98d9d53 (patch)
treece12d8e658713777e5b205fd5137aeae957bceff /src/main/python/shapes
parent60380a253a7c4b862fad4d4111301044f28312b5 (diff)
downloadChemical-PFD-4eaa5eacee5778f290577eb63cbae163a98d9d53.tar.gz
Chemical-PFD-4eaa5eacee5778f290577eb63cbae163a98d9d53.tar.bz2
Chemical-PFD-4eaa5eacee5778f290577eb63cbae163a98d9d53.zip
serialization for scene items
Diffstat (limited to 'src/main/python/shapes')
-rw-r--r--src/main/python/shapes/line.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py
index dc0a09c..b798dff 100644
--- a/src/main/python/shapes/line.py
+++ b/src/main/python/shapes/line.py
@@ -893,4 +893,18 @@ class Line(QGraphicsPathItem):
addLableAction = contextMenu.addAction("add Label")
action = contextMenu.exec_(event.screenPos())
if action == addLableAction:
- self.label.append(LineLabel(event.scenePos(), self)) \ No newline at end of file
+ self.label.append(LineLabel(event.scenePos(), self))
+ 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"]]