summaryrefslogtreecommitdiff
path: root/src/main/python/shapes/line.py
diff options
context:
space:
mode:
authorpravindalve2020-06-22 16:37:47 +0530
committerGitHub2020-06-22 16:37:47 +0530
commitcca55e231036850b2ea235ef0e1a1dc05db2a4b0 (patch)
tree8ff6b465e177e632a544471e1ec4b4add9279045 /src/main/python/shapes/line.py
parentc3ca9374cfc2b91238e431055ab1cc2a0074a511 (diff)
parent5afc44d63266bb1e8a57a880d64b33f95b29e3d8 (diff)
downloadChemical-PFD-cca55e231036850b2ea235ef0e1a1dc05db2a4b0.tar.gz
Chemical-PFD-cca55e231036850b2ea235ef0e1a1dc05db2a4b0.tar.bz2
Chemical-PFD-cca55e231036850b2ea235ef0e1a1dc05db2a4b0.zip
Merge pull request #24 from Blakeinstein/master
Final PR
Diffstat (limited to 'src/main/python/shapes/line.py')
-rw-r--r--src/main/python/shapes/line.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py
index c893fe6..856869d 100644
--- a/src/main/python/shapes/line.py
+++ b/src/main/python/shapes/line.py
@@ -292,13 +292,16 @@ class LineLabel(QGraphicsTextItem):
"text": self.toPlainText(),
"index": self.index,
"gap": self.gap,
- "pos": (self.pos().x(), self.pos().y())
+ "pos": (self.pos().x(), self.pos().y()),
+ "values": self.values
}
def __setstate__(self, dict):
self.setPlainText(dict['text'])
self.index = dict['index']
self.gap = dict['gap']
+ for key, value in dict['values'].items():
+ self.values[key] = value
def findIndex(line, pos):
@@ -1008,8 +1011,9 @@ class Line(QGraphicsPathItem):
action = contextMenu.exec_(event.screenPos())
# check for label action and add text label as child
if action == addLableAction:
- print(event.scenePos(), event.pos())
- self.label.append(LineLabel(event.scenePos(), self)) # text label as child
+ label = LineLabel(event.scenePos(), self)
+ self.label.append(label) # text label as child
+ self.scene().labelAdded.emit(label)
def __getstate__(self):
return {
@@ -1022,8 +1026,14 @@ class Line(QGraphicsPathItem):
"refLine": hex(id(self.refLine)) if self.refLine else 0,
"refIndex": self.refIndex,
"label": [i for i in self.label],
- "id": hex(id(self))
+ "id": hex(id(self)),
+ "startGap": self.startGap,
+ "endGap": self.endGap
}
def __setstate__(self, dict):
self.points = [QPointF(x, y) for x, y in dict["points"]]
+ self.startPoint = QPointF(*dict['startPoint'])
+ self.endPoint = QPointF(*dict['endPoint'])
+ self.startGap = dict['startGap']
+ self.endGap = dict['endGap']