summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsumit2020-05-28 19:11:52 +0530
committersumit2020-05-28 19:11:52 +0530
commit237a19e87df926c2d66be49a1aa5c26edaf9add4 (patch)
treed47602401da7d6464a567cbf93c47301296d39ab /src
parent6ef014e0aa5d320f2c392c5e784b4eeba373aebf (diff)
downloadChemical-PFD-237a19e87df926c2d66be49a1aa5c26edaf9add4.tar.gz
Chemical-PFD-237a19e87df926c2d66be49a1aa5c26edaf9add4.tar.bz2
Chemical-PFD-237a19e87df926c2d66be49a1aa5c26edaf9add4.zip
open svg from resources
Diffstat (limited to 'src')
-rw-r--r--src/main/python/shapes/shapes.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index 0807e96..7db759c 100644
--- a/src/main/python/shapes/shapes.py
+++ b/src/main/python/shapes/shapes.py
@@ -1,4 +1,3 @@
-# from fbs_runtime.application_context.PyQt5 import ApplicationContext
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtSvg import QGraphicsSvgItem, QSvgRenderer
from PyQt5.QtWidgets import QLineEdit, QGraphicsItem, QGraphicsEllipseItem, QGraphicsProxyWidget, QGraphicsPathItem, \
@@ -6,11 +5,10 @@ from PyQt5.QtWidgets import QLineEdit, QGraphicsItem, QGraphicsEllipseItem, QGra
from PyQt5.QtGui import QPen, QColor, QFont, QCursor, QPainterPath, QPainter, QDrag, QBrush, QImage, QTransform
from PyQt5.QtCore import Qt, QRectF, QPointF, QSizeF, QEvent, QMimeData, QFile, QIODevice, QRect
-from line import Line
+from .line import Line
+from utils.app import fileImporter
-# resourceManager = ApplicationContext()
-
class GripItem(QGraphicsPathItem):
"""
@@ -294,14 +292,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.id = unitOperationType
+ self.id = None
self.m_renderer = NodeItem.renderer
- # self.m_renderer = QSvgRenderer("svg/" + unitOperationType + ".svg")
- # self.m_renderer = QSvgRenderer(resourceManager.get_resource(f'toolbar/{unitOperationType}.svg'))
+ # 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