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 +++- src/main/python/shapes/shapes.py | 3 ++- src/main/python/utils/canvas.py | 4 +++- src/main/python/utils/streamTable.py | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) 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'] diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py index 7205ba7..d492568 100644 --- a/src/main/python/shapes/shapes.py +++ b/src/main/python/shapes/shapes.py @@ -616,7 +616,8 @@ class NodeItem(QGraphicsSvgItem): "height": self.height, "pos": (self.pos().x(), self.pos().y()), "lineGripItems": [(hex(id(i)), i.m_index) for i in self.lineGripItems], - "label": self.label + "label": self.label, + "rotation": self.rotation } def __setstate__(self, dict): diff --git a/src/main/python/utils/canvas.py b/src/main/python/utils/canvas.py index e492878..ad8981d 100644 --- a/src/main/python/utils/canvas.py +++ b/src/main/python/utils/canvas.py @@ -143,7 +143,7 @@ class canvas(customView): "symbols": [i for i in self.painter.items() if isinstance(i, shapes.NodeItem)], "lines": sorted([i for i in self.painter.items() if isinstance(i, shapes.Line)], key = lambda x: 1 if x.refLine else 0), "landscape": self.landscape, - "streamTable": [self.streamTable, (self.streamTableRect.pos().x(), self.streamTable.pos().y())] if self.streamTable else False + "streamTable": [self.streamTable, (self.streamTableRect.pos().x(), self.streamTableRect.pos().y())] if self.streamTable else False } def __setstate__(self, dict): @@ -165,6 +165,7 @@ class canvas(customView): graphicLabel = shapes.ItemLabel(pos = QPointF(*item['label']['pos']), parent = graphic) graphicLabel.__setstate__(item['label']) self.painter.addItem(graphicLabel) + graphic.rotation = item['rotation'] for item in dict['lines']: line = shapes.Line(QPointF(*item['startPoint']), QPointF(*item['endPoint'])) @@ -189,6 +190,7 @@ class canvas(customView): self.painter.addItem(labelItem) line.updateLine() line.addGrabber() + print(line.startGripItem) if dict['streamTable']: table = streamTable(self.labelItems, self) diff --git a/src/main/python/utils/streamTable.py b/src/main/python/utils/streamTable.py index 52b62c1..b397016 100644 --- a/src/main/python/utils/streamTable.py +++ b/src/main/python/utils/streamTable.py @@ -155,7 +155,7 @@ class streamTable(QTableView): } def __setstate__(self, dict): - for key, value in dict['borderThickness']: + for key, value in dict['borderThickness'].items(): self.borderThickness[key] = value self.model.header = dict['header'] self.repaint() -- cgit