Skip to content
Snippets Groups Projects
Commit 4ea4ce71 authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Some more docs

parent 2783c4e7
No related branches found
No related tags found
1 merge request!157Some more docs
Pipeline #88771 passed
...@@ -28,7 +28,15 @@ class DragButton(QPushButton): ...@@ -28,7 +28,15 @@ class DragButton(QPushButton):
""" """
Drag button class. Drag button class.
This class creates a drag button which can be clicked, dragged and dropped. This class creates a button which can be clicked, dragged and dropped.
Parameters
----------
name
operation
is_show_name
window
parent
""" """
connectionRequested = Signal(QPushButton) connectionRequested = Signal(QPushButton)
......
"""
B-ASIC port button module.
"""
from qtpy.QtCore import Qt, Signal from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import QMenu, QPushButton from qtpy.QtWidgets import QMenu, QPushButton
class PortButton(QPushButton): class PortButton(QPushButton):
"""
A button corresponding to a port.
Parameters
----------
name
operation
port
window
parent
"""
connectionRequested = Signal(QPushButton) connectionRequested = Signal(QPushButton)
moved = Signal() moved = Signal()
......
"""
B-ASIC select SFG window.
"""
from qtpy.QtCore import Qt, Signal from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import QComboBox, QDialog, QPushButton, QVBoxLayout from qtpy.QtWidgets import QComboBox, QDialog, QPushButton, QVBoxLayout
......
"""
B-ASIC window to show precedence graph.
"""
from qtpy.QtCore import Qt, Signal from qtpy.QtCore import Qt, Signal
from qtpy.QtWidgets import ( from qtpy.QtWidgets import (
QCheckBox, QCheckBox,
......
"""
B-ASIC window to simulate an SFG.
"""
from matplotlib.backends.backend_qt5agg import ( from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg as FigureCanvas, FigureCanvasQTAgg as FigureCanvas,
) )
......
...@@ -59,7 +59,7 @@ class AxesItem(QGraphicsItemGroup): ...@@ -59,7 +59,7 @@ class AxesItem(QGraphicsItemGroup):
parent: Optional[QGraphicsItem] = None, parent: Optional[QGraphicsItem] = None,
): ):
""" """
Constructs a AxesItem. Construct an AxesItem.
*parent* is passed to QGraphicsItemGroup's constructor. *parent* is passed to QGraphicsItemGroup's constructor.
""" """
super().__init__(parent=parent) super().__init__(parent=parent)
......
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""B-ASIC Scheduler-gui Graphics Graph Event Module. """
B-ASIC Scheduler-gui Graphics Graph Event Module.
Contains the scheduler-gui SchedulerEvent class containing event filters and handlers for SchedulerItem objects. Contains the scheduler-gui SchedulerEvent class containing event filters and handlers for SchedulerItem objects.
""" """
...@@ -27,7 +28,14 @@ from b_asic.scheduler_gui.timeline_item import TimelineItem ...@@ -27,7 +28,14 @@ from b_asic.scheduler_gui.timeline_item import TimelineItem
class SchedulerEvent: # PyQt5 class SchedulerEvent: # PyQt5
"""Event filter and handlers for SchedulerItem""" """
Event filter and handlers for SchedulerItem.
Parameters
----------
parent : QGraphicsItem, optional
The parent QGraphicsItem.
"""
class Signals(QObject): # PyQt5 class Signals(QObject): # PyQt5
"""A class representing signals.""" """A class representing signals."""
...@@ -94,8 +102,10 @@ class SchedulerEvent: # PyQt5 ...@@ -94,8 +102,10 @@ class SchedulerEvent: # PyQt5
... ...
def removeSceneEventFilters(self, filterItems) -> None: def removeSceneEventFilters(self, filterItems) -> None:
"""Removes an event filter on 'filterItems' from 'self'. 'filterItems' can """
be one object or a list of objects.""" Removes an event filter on *filterItems* from *self*. *filterItems* can
be one object or a list of objects.
"""
item: OperationItem item: OperationItem
for item in filterItems: for item in filterItems:
item.removeSceneEventFilter(self) item.removeSceneEventFilter(self)
...@@ -220,7 +230,7 @@ class SchedulerEvent: # PyQt5 ...@@ -220,7 +230,7 @@ class SchedulerEvent: # PyQt5
def comp_mousePressEvent(self, event: QGraphicsSceneMouseEvent) -> None: def comp_mousePressEvent(self, event: QGraphicsSceneMouseEvent) -> None:
""" """
Changes the cursor to ClosedHandCursor when grabbing an object and Changes the cursor to ClosedHandCursor when grabbing an object and
stores the current position in item's parent coordinates. 'event' will stores the current position in item's parent coordinates. *event* will
by default be accepted, and this item is then the mouse grabber. This by default be accepted, and this item is then the mouse grabber. This
allows the item to receive future move, release and double-click events. allows the item to receive future move, release and double-click events.
""" """
...@@ -284,7 +294,8 @@ class SchedulerEvent: # PyQt5 ...@@ -284,7 +294,8 @@ class SchedulerEvent: # PyQt5
def timeline_mousePressEvent( def timeline_mousePressEvent(
self, event: QGraphicsSceneMouseEvent self, event: QGraphicsSceneMouseEvent
) -> None: ) -> None:
"""Store the current position in item's parent coordinates. 'event' will """
Store the current position in item's parent coordinates. *event* will
by default be accepted, and this item is then the mouse grabber. This by default be accepted, and this item is then the mouse grabber. This
allows the item to receive future move, release and double-click events. allows the item to receive future move, release and double-click events.
""" """
......
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""B-ASIC Scheduler-gui Graphics Graph Item Module. """
B-ASIC Scheduler-gui Graphics Graph Item Module.
Contains the scheduler-gui SchedulerItem class for drawing and Contains the scheduler-gui SchedulerItem class for drawing and
maintain a component in a graph. maintain a component in a graph.
......
...@@ -17,6 +17,21 @@ from b_asic.signal import Signal ...@@ -17,6 +17,21 @@ from b_asic.signal import Signal
class SignalItem(QGraphicsPathItem): class SignalItem(QGraphicsPathItem):
"""
Class representing a signal in the scheduler GUI.
Parameters
----------
src_operation : OperationItem
The operation that the signal is drawn from.
dest_operation : OperationItem
The operation that the signal is drawn to.
signal : Signal
The signal on the SFG level.
parent : QGraphicsItem, optional
The parent QGraphicsItem.
"""
_path: Optional[QPainterPath] = None _path: Optional[QPainterPath] = None
_src_operation: OperationItem _src_operation: OperationItem
_dest_operation: OperationItem _dest_operation: OperationItem
...@@ -79,6 +94,7 @@ class SignalItem(QGraphicsPathItem): ...@@ -79,6 +94,7 @@ class SignalItem(QGraphicsPathItem):
self.setPath(path) self.setPath(path)
def refresh_pens(self): def refresh_pens(self):
"""Create pens."""
pen = QPen(SIGNAL_ACTIVE) pen = QPen(SIGNAL_ACTIVE)
pen.setWidthF(SIGNAL_WIDTH) pen.setWidthF(SIGNAL_WIDTH)
self._active_pen = pen self._active_pen = pen
...@@ -87,7 +103,10 @@ class SignalItem(QGraphicsPathItem): ...@@ -87,7 +103,10 @@ class SignalItem(QGraphicsPathItem):
self._inactive_pen = pen self._inactive_pen = pen
def set_active(self): def set_active(self):
"""Set the signal color to represent that a connected operation is selected.
"""
self.setPen(self._active_pen) self.setPen(self._active_pen)
def set_inactive(self): def set_inactive(self):
"""Set the signal color to the default color."""
self.setPen(self._inactive_pen) self.setPen(self._inactive_pen)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment