diff options
author | pravindalve | 2020-06-10 17:22:06 +0530 |
---|---|---|
committer | GitHub | 2020-06-10 17:22:06 +0530 |
commit | fd3ff2c037805a6539a9044bd9d26c3400768be8 (patch) | |
tree | e39adff23664647035bdf9c12357b820ed204065 /src/main/python/shapes/line.py | |
parent | 0d33ceda3262494437fe022466e4368db62c8849 (diff) | |
parent | 48549adea85f9dd08da71b4e4dd310858a391e22 (diff) | |
download | Chemical-PFD-fd3ff2c037805a6539a9044bd9d26c3400768be8.tar.gz Chemical-PFD-fd3ff2c037805a6539a9044bd9d26c3400768be8.tar.bz2 Chemical-PFD-fd3ff2c037805a6539a9044bd9d26c3400768be8.zip |
Merge pull request #12 from Blakeinstein/master
Implement saving + implement svg files
Diffstat (limited to 'src/main/python/shapes/line.py')
-rw-r--r-- | src/main/python/shapes/line.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py index 92c5b1d..466e22b 100644 --- a/src/main/python/shapes/line.py +++ b/src/main/python/shapes/line.py @@ -259,6 +259,19 @@ class LineLabel(QGraphicsTextItem): def focusOutEvent(self, event): super(LineLabel, self).focusOutEvent(event) self.setTextInteractionFlags(Qt.NoTextInteraction) + + def __getstate__(self): + return { + "text": self.toPlainText(), + "index": self.index, + "gap": self.gap, + "pos": (self.pos().x(), self.pos().y()) + } + + def __setstate__(self, dict): + self.setPlainText(dict['text']) + self.index = dict['index'] + self.gap = dict['gap'] def findIndex(line, pos): @@ -919,8 +932,13 @@ class Line(QGraphicsPathItem): "_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] + "points": [(point.x(), point.y()) for point in self.points], + "startGripItem": hex(id(self.startGripItem)), + "endGripItem": hex(id(self.endGripItem)) if self.endGripItem else 0, + "refLine": hex(id(self.refLine)) if self.refLine else 0, + "refIndex": self.refIndex, + "label": [i for i in self.label], + "id": hex(id(self)) } - def __setstate__(self, dict): self.points = [QPointF(x, y) for x, y in dict["points"]] |