summaryrefslogtreecommitdiff
path: root/src/main/python/shapes/shapes.py
diff options
context:
space:
mode:
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()