summaryrefslogtreecommitdiff
path: root/src/main/python
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/python')
-rw-r--r--src/main/python/shapes/shapes.py7
-rw-r--r--src/main/python/utils/toolbar.py21
2 files changed, 15 insertions, 13 deletions
diff --git a/src/main/python/shapes/shapes.py b/src/main/python/shapes/shapes.py
index 5f673cf..b825653 100644
--- a/src/main/python/shapes/shapes.py
+++ b/src/main/python/shapes/shapes.py
@@ -326,16 +326,13 @@ class NodeItem(QGraphicsSvgItem):
Extends PyQt5's QGraphicsSvgItem to create the basic structure of shapes with given unit operation type
"""
# set a common renderer for all svg
- renderer = QSvgRenderer(fileImporter(f'svg/ellipse.svg'))
+ # renderer = QSvgRenderer(fileImporter(f'svg/ellipse.svg'))
def __init__(self, unitOperationType=None, parent=None):
QGraphicsSvgItem.__init__(self, parent)
self.m_type = str(unitOperationType)
self.id = None
- # 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.m_renderer = QSvgRenderer(fileImporter(f'{unitOperationType}.svg'))
self.setSharedRenderer(self.m_renderer)
# set initial size of item
self.width = 100
diff --git a/src/main/python/utils/toolbar.py b/src/main/python/utils/toolbar.py
index af6feae..7883136 100644
--- a/src/main/python/utils/toolbar.py
+++ b/src/main/python/utils/toolbar.py
@@ -20,6 +20,7 @@ class toolbar(QDockWidget):
def __init__(self, parent = None):
super(toolbar, self).__init__(parent)
self.toolbarButtonDict = dict() #initializes empty dict to store toolbar buttons
+ self.toolbarButtonClassList = []
self.toolbarItems(toolbarItems.keys()) #creates all necessary buttons
self.setFeatures(QDockWidget.DockWidgetFloatable | QDockWidget.DockWidgetMovable)
@@ -59,8 +60,9 @@ class toolbar(QDockWidget):
def populateToolbar(self, list):
#called everytime the button box needs to be updated(incase of a filter)
self.clearLayout() #clears layout
- for item in list:
- self.diagAreaLayout.addWidget(self.toolbarButtonDict[item])
+ for itemClass in list:
+ for item in self.toolbarButtonDict[itemClass].keys():
+ self.diagAreaLayout.addWidget(self.toolbarButtonDict[itemClass][item])
self.resize()
def searchQuery(self):
@@ -86,13 +88,16 @@ class toolbar(QDockWidget):
self.diagAreaWidget.setLayout(self.diagAreaLayout)
self.diagArea.setWidget(self.diagAreaWidget)
- def toolbarItems(self, items):
+ def toolbarItems(self, itemClasses):
#helper functions to create required buttons
- for item in items:
- obj = toolbarItems[item]
- button = toolbarButton(self, obj)
- button.clicked.connect(lambda : self.toolbuttonClicked.emit(obj))
- self.toolbarButtonDict[item] = button
+ for itemClass in itemClasses:
+ self.toolbarButtonDict[itemClass] = {}
+ self.toolbarButtonClassList.append(itemClass)
+ for item in toolbarItems[itemClass].keys():
+ obj = toolbarItems[itemClass][item]
+ button = toolbarButton(self, obj)
+ button.clicked.connect(lambda : self.toolbuttonClicked.emit(obj))
+ self.toolbarButtonDict[itemClass][item] = button
@property
def toolbarItemList(self):