summaryrefslogtreecommitdiff
path: root/src/main/python/shapes
diff options
context:
space:
mode:
authorBlaine2020-06-09 12:39:52 +0530
committerBlaine2020-06-10 11:29:49 +0530
commit2cdd1b40a2cf410ea1970afeb692649e7cd07b29 (patch)
treeea2a9490f767d644c3241e1ab18674af831d98a1 /src/main/python/shapes
parent0d33ceda3262494437fe022466e4368db62c8849 (diff)
downloadChemical-PFD-2cdd1b40a2cf410ea1970afeb692649e7cd07b29.tar.gz
Chemical-PFD-2cdd1b40a2cf410ea1970afeb692649e7cd07b29.tar.bz2
Chemical-PFD-2cdd1b40a2cf410ea1970afeb692649e7cd07b29.zip
implement id logic
Diffstat (limited to 'src/main/python/shapes')
-rw-r--r--src/main/python/shapes/line.py8
-rw-r--r--src/main/python/shapes/shapes.py7
2 files changed, 8 insertions, 7 deletions
diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py
index 92c5b1d..85c5753 100644
--- a/src/main/python/shapes/line.py
+++ b/src/main/python/shapes/line.py
@@ -919,8 +919,12 @@ 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,
+ "id": hex(id(self))
}
-
def __setstate__(self, dict):
self.points = [QPointF(x, y) for x, y in dict["points"]]
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index 0358898..774951d 100644
--- a/src/main/python/shapes/shapes.py
+++ b/src/main/python/shapes/shapes.py
@@ -12,7 +12,6 @@ from PyQt5.QtWidgets import (QGraphicsColorizeEffect, QGraphicsEllipseItem,
from .line import Line, findIndex
from utils.app import fileImporter
-from utils.app import fileImporter
class ItemLabel(QGraphicsTextItem):
def __init__(self, pos, parent=None):
@@ -498,7 +497,8 @@ class NodeItem(QGraphicsSvgItem):
"_classname_": self.__class__.__name__,
"width": self.width,
"height": self.height,
- "pos": (self.pos().x(), self.pos().y())
+ "pos": (self.pos().x(), self.pos().y()),
+ "lineGripItems": [(hex(id(i)), i.m_index) for i in self.lineGripItems]
}
def __setstate__(self, dict):
@@ -506,9 +506,6 @@ class NodeItem(QGraphicsSvgItem):
self.width = dict['width']
self.height = dict['height']
self.rect = QRectF(-self.width / 2, -self.height / 2, self.width, self.height)
- transform = QTransform()
- transform.translate(self.width / 2, self.height / 2)
- self.setTransform(transform, True)
self.updateSizeGripItem()
# classes of pfd-symbols