summaryrefslogtreecommitdiff
path: root/src/main/python/shapes/shapes.py
diff options
context:
space:
mode:
authorsumit2020-05-28 10:07:54 +0530
committerBlaine2020-06-03 15:21:17 +0530
commit1b6f49af4a8feacfdaf1f914600f9ae9ab863586 (patch)
tree6d73cb916ea75c7f15e1b6a27666a35723eff64a /src/main/python/shapes/shapes.py
parent809cd1f50d320482600e7ab190dc5e13bff3bf02 (diff)
downloadChemical-PFD-1b6f49af4a8feacfdaf1f914600f9ae9ab863586.tar.gz
Chemical-PFD-1b6f49af4a8feacfdaf1f914600f9ae9ab863586.tar.bz2
Chemical-PFD-1b6f49af4a8feacfdaf1f914600f9ae9ab863586.zip
change final shape of line
Diffstat (limited to 'src/main/python/shapes/shapes.py')
-rw-r--r--src/main/python/shapes/shapes.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index e79ddb7..5c39125 100644
--- a/src/main/python/shapes/shapes.py
+++ b/src/main/python/shapes/shapes.py
@@ -53,7 +53,7 @@ class SizeGripItem(GripItem):
self.width = annotation_item.boundingRect().width()
path = QPainterPath()
- path.addRect(QRectF(-self.width/2, -self.height/2, self.width, self.height))
+ path.addRect(QRectF(-self.width / 2, -self.height / 2, self.width, self.height))
super(SizeGripItem, self).__init__(annotation_item, path=path, parent=parent)
self.setFlag(QGraphicsItem.ItemIsSelectable, True)
self.setFlag(QGraphicsItem.ItemIsMovable, True)
@@ -84,7 +84,7 @@ class SizeGripItem(GripItem):
else:
self.width = self.parentItem().boundingRect().width()
path = QPainterPath()
- path.addRect(QRectF(-self.width/2, -self.height/2, self.width, self.height))
+ path.addRect(QRectF(-self.width / 2, -self.height / 2, self.width, self.height))
self.setPath(path)
def updatePosition(self):
@@ -212,8 +212,7 @@ class LineGripItem(GripItem):
# initialize a line and add on scene
startPoint = endPoint = self.parentItem().mapToScene(self.pos())
self.tempLine = Line(startPoint, endPoint)
- self.tempLine.setStartGripItem(self)
- self.scene().addItemPlus(self.tempLine)
+ self.scene().addItem(self.tempLine)
super().mousePressEvent(mouseEvent)
def mouseMoveEvent(self, mouseEvent):
@@ -245,6 +244,7 @@ class LineGripItem(GripItem):
self.transform())
if type(item) == LineGripItem and item != self:
+ self.tempLine.setStartGripItem(self)
self.tempLine.setEndGripItem(item)
endPoint = item.parentItem().mapToScene(item.pos())
self.tempLine.updateLine(endPoint=endPoint)
@@ -281,6 +281,7 @@ class NodeItem(QGraphicsSvgItem):
"""
Extends PyQt5's QGraphicsSvgItem to create the basic structure of shapes with given unit operation type
"""
+ renderer = QSvgRenderer("For sample svg_2.svg")
def __init__(self, unitOperationType, parent=None):
QGraphicsSvgItem.__init__(self, parent)
@@ -319,7 +320,10 @@ class NodeItem(QGraphicsSvgItem):
"""
if not self.m_renderer:
QGraphicsSvgItem.paint(self, painter, option, widget)
- self.m_renderer.render(painter, self.boundingRect())
+ elif self.id:
+ self.m_renderer.render(painter,self.id, self.boundingRect())
+ else:
+ self.m_renderer.render(painter, self.boundingRect())
if self.isSelected():
self.showGripItem()