diff options
author | brenda-br | 2023-02-20 13:16:51 +0530 |
---|---|---|
committer | brenda-br | 2023-02-20 13:16:51 +0530 |
commit | f188f7d75a73a1cda3c9e65505fffdd0f8c063e2 (patch) | |
tree | c8572490815cd5ed882542f3c5c59935ce399b47 /src/main/python/shapes/line.py | |
parent | 843d6bc29f6057606230bf55d48b560862fe66b8 (diff) | |
download | Chemical-PFD-f188f7d75a73a1cda3c9e65505fffdd0f8c063e2.tar.gz Chemical-PFD-f188f7d75a73a1cda3c9e65505fffdd0f8c063e2.tar.bz2 Chemical-PFD-f188f7d75a73a1cda3c9e65505fffdd0f8c063e2.zip |
Reattaching Node Line to Node Item
Diffstat (limited to 'src/main/python/shapes/line.py')
-rw-r--r-- | src/main/python/shapes/line.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/main/python/shapes/line.py b/src/main/python/shapes/line.py index 856869d..4e5271a 100644 --- a/src/main/python/shapes/line.py +++ b/src/main/python/shapes/line.py @@ -5,6 +5,18 @@ from PyQt5.QtCore import Qt, QPointF, QRectF, QLineF, pyqtSignal from collections import defaultdict +#For extending Lines for repositioned Rectangular Line Grips +rLGPlus = {} +f = open('./shapes/rLGPlus.txt','r') +dataRead = f.readlines()[1:] +for line in dataRead: + + if not line.__contains__(',') : + rLGPlus[line.strip()] = [] + else: + grips = line.strip().split(',') + rLGPlus[list(rLGPlus.keys())[-1]].append(grips) + class Grabber(QGraphicsPathItem): """ Extends QGraphicsPathItem to create grabber for line for moving a particular segment @@ -796,6 +808,31 @@ class Line(QGraphicsPathItem): def updatePath(self): """ update path when svg item moves """ + #Adjusting line for repositioned retangular grips + if self.startGripItem.parentItem().__class__.__name__ in list(rLGPlus.keys()): + for tgrip in rLGPlus[self.startGripItem.parentItem().__class__.__name__]: + if(float(tgrip[3]) == 0): + if self.startGripItem.m_location == tgrip[0]: + tempx,tempy = int(tgrip[1]),int(tgrip[2]) + self.startPoint.setX(self.startPoint.x()+tempx) + self.startPoint.setY(self.startPoint.y()+tempy) + else: + if self.startGripItem.m_location == tgrip[0] and self.startGripItem.size == float(tgrip[3]): + tempx,tempy = int(tgrip[1]),int(tgrip[2]) + self.startPoint.setX(self.startPoint.x()+tempx) + self.startPoint.setY(self.startPoint.y()+tempy) + if self.endGripItem.parentItem().__class__.__name__ in list(rLGPlus.keys()): + for tgrip in rLGPlus[self.endGripItem.parentItem().__class__.__name__]: + if(float(tgrip[3]) == 0): + if self.endGripItem.m_location == tgrip[0]: + tempx,tempy = int(tgrip[1]),int(tgrip[2]) + self.endPoint.setX(self.endPoint.x()+tempx) + self.endPoint.setY(self.endPoint.y()+tempy) + else: + if self.endGripItem.m_location == tgrip[0] and self.endGripItems.size == float(tgrip[3]): + tempx,tempy = int(tgrip[1]),int(tgrip[2]) + self.endPoint.setX(self.endPoint.x()+tempx) + self.endPoint.setY(self.endPoint.y()+tempy) path = QPainterPath(self.startPoint) self.updatePoints() |