diff options
author | sumit | 2020-05-28 19:11:52 +0530 |
---|---|---|
committer | Blaine | 2020-06-03 15:21:59 +0530 |
commit | 34b798e22ef468878176ee45c146290839f1afbc (patch) | |
tree | edb0818e8a84fa36a75b95a0be3bde9a9c509a70 /src | |
parent | 1b6f49af4a8feacfdaf1f914600f9ae9ab863586 (diff) | |
download | Chemical-PFD-34b798e22ef468878176ee45c146290839f1afbc.tar.gz Chemical-PFD-34b798e22ef468878176ee45c146290839f1afbc.tar.bz2 Chemical-PFD-34b798e22ef468878176ee45c146290839f1afbc.zip |
open svg from resources
Diffstat (limited to 'src')
-rw-r--r-- | src/main/python/shapes/shapes.py | 16 |
1 files changed, 8 insertions, 8 deletions
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 |