Skip to content
Snippets Groups Projects

Add scheduler GUI

Merged Oscar Gustafsson requested to merge scheduler-gui into master
4 files
+ 41
9
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -68,6 +68,11 @@ class GraphicsComponentItem(QGraphicsItemGroup):
"""Get the op-id."""
return self._operation.graph_id
@property
def operation(self) -> GraphComponent:
"""Get the operation."""
return self._operation
@property
def height(self) -> float:
"""Get or set the current component height. Setting the height to a new
@@ -86,12 +91,14 @@ class GraphicsComponentItem(QGraphicsItemGroup):
"""Get the relative end time."""
return self._end_time
@property
def event_items(self) -> List[QGraphicsItem]:
"""Returnes a list of objects, that receives events."""
return [self]
def get_port_location(self, key) -> QPointF:
return self.mapToParent(self._ports[key]['pos'])
def _make_component(self) -> None:
"""Makes a new component out of the stored attributes."""
brush1 = QBrush(Qt.lightGray) # used by component filling
@@ -170,10 +177,10 @@ class GraphicsComponentItem(QGraphicsItemGroup):
for port_dict in self._ports.values():
port_pos = self.mapToParent(port_dict['pos'])
port = QGraphicsEllipseItem(-port_size/2, -port_size/2, port_size, port_size) # center of circle is in origo
port.setPen(pen2)
port.setBrush(brush2)
port.setPos(port_pos.x(), port_pos.y())
self._port_items.append(port)
self._port_items[-1].setPen(pen2)
self._port_items[-1].setBrush(brush2)
self._port_items[-1].setPos(port_pos.x(), port_pos.y())
## op-id/label
self._label_item = QGraphicsSimpleTextItem(self._operation.graph_id)
Loading