From 384bdf5f033ba1453efdbb8baf43cdaa9049c9df Mon Sep 17 00:00:00 2001 From: Blaine Date: Thu, 18 Jun 2020 14:27:19 +0530 Subject: fix line updation --- src/main/python/shapes/line.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/main/python/shapes/line.py') diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py index c893fe6..6883662 100644 --- a/src/main/python/shapes/line.py +++ b/src/main/python/shapes/line.py @@ -1008,8 +1008,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 { -- cgit From c0c5fe6186ca5776c9ff8199b88c13c2ad0e72a8 Mon Sep 17 00:00:00 2001 From: Blaine Date: Thu, 18 Jun 2020 15:43:57 +0530 Subject: save fileupdate --- src/main/python/shapes/line.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main/python/shapes/line.py') diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py index 6883662..57778fa 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']: + self.values[key] = value def findIndex(line, pos): @@ -1023,8 +1026,12 @@ 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.startGap = dict['startGap'] + self.endGap = dict['endGap'] -- cgit From 85a2d6f42168a9e693b7649b979b86f7a94d6ca3 Mon Sep 17 00:00:00 2001 From: Blaine Date: Thu, 18 Jun 2020 15:59:40 +0530 Subject: save update 2 --- src/main/python/shapes/line.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/main/python/shapes/line.py') diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py index 57778fa..856869d 100644 --- a/src/main/python/shapes/line.py +++ b/src/main/python/shapes/line.py @@ -300,7 +300,7 @@ class LineLabel(QGraphicsTextItem): self.setPlainText(dict['text']) self.index = dict['index'] self.gap = dict['gap'] - for key, value in dict['values']: + for key, value in dict['values'].items(): self.values[key] = value @@ -1033,5 +1033,7 @@ class Line(QGraphicsPathItem): 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'] -- cgit