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

Unify naming

parent bd9caefb
No related branches found
No related tags found
1 merge request!497Unify naming
Pipeline #158994 passed
......@@ -52,8 +52,8 @@ class AboutWindow(QDialog):
" Toolbox__\n\n*Construct, simulate and analyze signal processing"
" algorithms aimed at implementation on an ASIC or"
" FPGA.*\n\nB-ASIC is developed by the <a"
" href=\"https://liu.se/en/organisation/liu/isy/da\">Division of"
" Computer Engineering</a> at <a"
" href=\"https://liu.se/en/organisation/liu/isy/elda\">Division of"
" Electronics and Computer Engineering</a> at <a"
" href=\"https://liu.se/?l=en\">Linköping University</a>,"
" Sweden.\n\nB-ASIC is released under the <a"
" href=\"https://gitlab.liu.se/da/B-ASIC/-/blob/master/LICENSE\">"
......
......@@ -36,23 +36,23 @@ class ColorDataType:
self.name = name
Latency_Color = ColorDataType(
LATENCY_COLOR_TYPE = ColorDataType(
current_color=OPERATION_LATENCY_INACTIVE,
DEFAULT=OPERATION_LATENCY_INACTIVE,
name='Latency Color',
)
Execution_Time_Color = ColorDataType(
EXECUTION_TIME_COLOR_TYPE = ColorDataType(
current_color=OPERATION_EXECUTION_TIME_ACTIVE,
DEFAULT=OPERATION_EXECUTION_TIME_ACTIVE,
name='Execution Time Color',
)
Signal_Warning_Color = ColorDataType(
SIGNAL_WARNING_COLOR_TYPE = ColorDataType(
current_color=SIGNAL_WARNING, DEFAULT=SIGNAL_WARNING, name='Warning Color'
)
Signal_Color = ColorDataType(
SIGNAL_COLOR_TYPE = ColorDataType(
current_color=SIGNAL_INACTIVE, DEFAULT=SIGNAL_INACTIVE, name='Signal Color'
)
Active_Color = ColorDataType(
ACTIVE_COLOR_TYPE = ColorDataType(
current_color=SIGNAL_ACTIVE, DEFAULT=SIGNAL_ACTIVE, name='Active Color'
)
......@@ -79,6 +79,6 @@ class FontDataType:
self.changed = changed
Font = FontDataType(
FONT = FontDataType(
current_font=DEFAULT_FONT, DEFAULT=DEFAULT_FONT, DEFAULT_COLOR=DEFAULT_FONT_COLOR
)
This diff is collapsed.
......@@ -26,12 +26,12 @@ from b_asic.graph_component import GraphID
from b_asic.gui_utils.icons import get_icon
from b_asic.operation import Operation
from b_asic.scheduler_gui._preferences import (
ACTIVE_COLOR_TYPE,
EXECUTION_TIME_COLOR_TYPE,
LATENCY_COLOR_TYPE,
OPERATION_HEIGHT,
Active_Color,
Execution_Time_Color,
Latency_Color,
Signal_Color,
Signal_Warning_Color,
SIGNAL_COLOR_TYPE,
SIGNAL_WARNING_COLOR_TYPE,
)
if TYPE_CHECKING:
......@@ -63,7 +63,7 @@ class OperationItem(QGraphicsItemGroup):
_label_item: QGraphicsSimpleTextItem
_port_items: list[QGraphicsEllipseItem]
_port_number_items: list[QGraphicsSimpleTextItem]
_inactive_color: QColor = Latency_Color.DEFAULT
_inactive_color: QColor = LATENCY_COLOR_TYPE.DEFAULT
def __init__(
self,
......@@ -97,30 +97,32 @@ class OperationItem(QGraphicsItemGroup):
QCursor(Qt.CursorShape.OpenHandCursor)
) # default cursor when hovering over object
if Signal_Color.changed:
self._port_filling_brush = QBrush(Signal_Color.current_color)
self._port_outline_pen = QPen(Signal_Color.current_color)
if SIGNAL_COLOR_TYPE.changed:
self._port_filling_brush = QBrush(SIGNAL_COLOR_TYPE.current_color)
self._port_outline_pen = QPen(SIGNAL_COLOR_TYPE.current_color)
else:
self._port_filling_brush = QBrush(Signal_Color.DEFAULT)
self._port_outline_pen = QPen(Signal_Color.DEFAULT)
self._port_filling_brush = QBrush(SIGNAL_COLOR_TYPE.DEFAULT)
self._port_outline_pen = QPen(SIGNAL_COLOR_TYPE.DEFAULT)
self._port_outline_pen.setWidthF(0)
if Active_Color.changed:
self._port_filling_brush_active = QBrush(Active_Color.current_color)
self._port_outline_pen_active = QPen(Active_Color.current_color)
if ACTIVE_COLOR_TYPE.changed:
self._port_filling_brush_active = QBrush(ACTIVE_COLOR_TYPE.current_color)
self._port_outline_pen_active = QPen(ACTIVE_COLOR_TYPE.current_color)
else:
self._port_filling_brush_active = QBrush(Active_Color.DEFAULT)
self._port_outline_pen_active = QPen(Active_Color.DEFAULT)
self._port_filling_brush_active = QBrush(ACTIVE_COLOR_TYPE.DEFAULT)
self._port_outline_pen_active = QPen(ACTIVE_COLOR_TYPE.DEFAULT)
self._port_outline_pen_active.setWidthF(0)
if Signal_Warning_Color.changed:
if SIGNAL_WARNING_COLOR_TYPE.changed:
self._port_filling_brush_warning = QBrush(
Signal_Warning_Color.current_color
SIGNAL_WARNING_COLOR_TYPE.current_color
)
self._port_outline_pen_warning = QPen(
SIGNAL_WARNING_COLOR_TYPE.current_color
)
self._port_outline_pen_warning = QPen(Signal_Warning_Color.current_color)
else:
self._port_filling_brush_warning = QBrush(Signal_Warning_Color.DEFAULT)
self._port_outline_pen_warning = QPen(Signal_Warning_Color.DEFAULT)
self._port_filling_brush_warning = QBrush(SIGNAL_WARNING_COLOR_TYPE.DEFAULT)
self._port_outline_pen_warning = QPen(SIGNAL_WARNING_COLOR_TYPE.DEFAULT)
self._port_outline_pen_warning.setWidthF(0)
self._make_component()
......@@ -198,18 +200,18 @@ class OperationItem(QGraphicsItemGroup):
def set_active(self) -> None:
"""Set the item as active, i.e., draw it in special colors."""
if Active_Color.changed:
self._set_background(Active_Color.current_color)
if ACTIVE_COLOR_TYPE.changed:
self._set_background(ACTIVE_COLOR_TYPE.current_color)
else:
self._set_background(Active_Color.DEFAULT)
self._set_background(ACTIVE_COLOR_TYPE.DEFAULT)
self.setCursor(QCursor(Qt.CursorShape.ClosedHandCursor))
def set_inactive(self) -> None:
"""Set the item as inactive, i.e., draw it in standard colors."""
if Latency_Color.changed:
if LATENCY_COLOR_TYPE.changed:
self._set_background(self._inactive_color)
else:
self._set_background(Latency_Color.DEFAULT)
self._set_background(LATENCY_COLOR_TYPE.DEFAULT)
self.setCursor(QCursor(Qt.CursorShape.OpenHandCursor))
def Set_font(self, font: QFont) -> None:
......@@ -231,12 +233,12 @@ class OperationItem(QGraphicsItemGroup):
def set_port_active(self, key: str):
item = self._ports[key]["item"]
if Active_Color.changed:
self._port_filling_brush_active = QBrush(Active_Color.current_color)
self._port_outline_pen_active = QPen(Active_Color.current_color)
if ACTIVE_COLOR_TYPE.changed:
self._port_filling_brush_active = QBrush(ACTIVE_COLOR_TYPE.current_color)
self._port_outline_pen_active = QPen(ACTIVE_COLOR_TYPE.current_color)
else:
self._port_filling_brush_active = QBrush(Active_Color.DEFAULT)
self._port_outline_pen_active = QPen(Active_Color.DEFAULT)
self._port_filling_brush_active = QBrush(ACTIVE_COLOR_TYPE.DEFAULT)
self._port_outline_pen_active = QPen(ACTIVE_COLOR_TYPE.DEFAULT)
self._port_outline_pen_active.setWidthF(0)
item.setBrush(self._port_filling_brush_active)
......@@ -267,10 +269,10 @@ class OperationItem(QGraphicsItemGroup):
port_size = 7 / self._scale # the diameter of a port
if Execution_Time_Color.changed:
execution_time_color = QColor(Execution_Time_Color.current_color)
if EXECUTION_TIME_COLOR_TYPE.changed:
execution_time_color = QColor(EXECUTION_TIME_COLOR_TYPE.current_color)
else:
execution_time_color = QColor(Execution_Time_Color.DEFAULT)
execution_time_color = QColor(EXECUTION_TIME_COLOR_TYPE.DEFAULT)
execution_time_color.setAlpha(200) # 0-255
execution_time_pen = QPen() # used by execution time outline
execution_time_pen.setColor(execution_time_color)
......@@ -298,7 +300,7 @@ class OperationItem(QGraphicsItemGroup):
self._execution_time_item.setPen(execution_time_pen)
# component item
self._set_background(Latency_Color.DEFAULT) # used by component filling
self._set_background(LATENCY_COLOR_TYPE.DEFAULT) # used by component filling
def create_ports(io_coordinates, prefix):
for i, (x, y) in enumerate(io_coordinates):
......
......@@ -13,13 +13,13 @@ from qtpy.QtWidgets import QGraphicsPathItem
# B-ASIC
from b_asic.scheduler_gui._preferences import (
ACTIVE_COLOR_TYPE,
SCHEDULE_INDENT,
SIGNAL_COLOR_TYPE,
SIGNAL_WARNING_COLOR_TYPE,
SIGNAL_WIDTH,
SIGNAL_WIDTH_ACTIVE,
SIGNAL_WIDTH_WARNING,
Active_Color,
Signal_Color,
Signal_Warning_Color,
)
from b_asic.scheduler_gui.operation_item import OperationItem
from b_asic.signal import Signal
......@@ -100,24 +100,24 @@ class SignalItem(QGraphicsPathItem):
def _refresh_pens(self) -> None:
"""Create pens."""
if Active_Color.changed:
pen = QPen(Active_Color.current_color)
if ACTIVE_COLOR_TYPE.changed:
pen = QPen(ACTIVE_COLOR_TYPE.current_color)
else:
pen = QPen(Active_Color.DEFAULT)
pen = QPen(ACTIVE_COLOR_TYPE.DEFAULT)
pen.setWidthF(SIGNAL_WIDTH_ACTIVE)
self._active_pen = pen
if Signal_Color.changed:
pen = QPen(Signal_Color.current_color)
if SIGNAL_COLOR_TYPE.changed:
pen = QPen(SIGNAL_COLOR_TYPE.current_color)
else:
pen = QPen(Signal_Color.DEFAULT)
pen = QPen(SIGNAL_COLOR_TYPE.DEFAULT)
pen.setWidthF(SIGNAL_WIDTH)
self._inactive_pen = pen
if Signal_Warning_Color.changed:
pen = QPen(Signal_Warning_Color.current_color)
if SIGNAL_WARNING_COLOR_TYPE.changed:
pen = QPen(SIGNAL_WARNING_COLOR_TYPE.current_color)
else:
pen = QPen(Signal_Warning_Color.DEFAULT)
pen = QPen(SIGNAL_WARNING_COLOR_TYPE.DEFAULT)
pen.setWidthF(SIGNAL_WIDTH_WARNING)
self._warning_pen = 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