From 34b798e22ef468878176ee45c146290839f1afbc Mon Sep 17 00:00:00 2001 From: sumit Date: Thu, 28 May 2020 19:11:52 +0530 Subject: open svg from resources --- src/main/python/shapes/shapes.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py index 5c39125..4615ab1 100644 --- a/src/main/python/shapes/shapes.py +++ b/src/main/python/shapes/shapes.py @@ -9,9 +9,9 @@ from PyQt5.QtWidgets import (QGraphicsColorizeEffect, QGraphicsEllipseItem, QGraphicsProxyWidget, QGraphicsSceneHoverEvent, QLineEdit) -from utils.app import fileImporter - from .line import Line +from utils.app import fileImporter + class GripItem(QGraphicsPathItem): @@ -281,15 +281,15 @@ 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") + # set a common renderer for all svg + renderer = QSvgRenderer(fileImporter(f'svg/ellipse.svg')) def __init__(self, unitOperationType, parent=None): QGraphicsSvgItem.__init__(self, parent) - self.m_type = unitOperationType - # self.m_renderer = QSvgRenderer("svg/" + unitOperationType + ".svg") - # self.m_renderer = QSvgRenderer(fileImporter(f'svg/{unitOperationType}.svg')) - self.m_renderer = QSvgRenderer(fileImporter(f'svg/ellipse.svg')) - # self.m_renderer = QSvgRenderer(resourceManager.get_resource(f'toolbar/{unitOperationType}.svg')) + self.id = None + self.m_renderer = NodeItem.renderer + # if each svg is seperate file + # self.m_renderer = QSvgRenderer(fileImporter(f'svg/ellipse.svg')) self.setSharedRenderer(self.m_renderer) # set initial size of item self.width = 100 -- cgit