Bond graph ports and drawing added
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Literal
|
||||
|
||||
from PySide6.QtCore import Qt
|
||||
|
||||
|
||||
ArrowStyle = Literal["open", "half", "filled"]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class ConnectionStyle:
|
||||
color: str = "#285f9e"
|
||||
@@ -13,11 +17,17 @@ class ConnectionStyle:
|
||||
arrow_at_source: bool = False
|
||||
arrow_at_target: bool = True
|
||||
arrow_size: float = 10.0
|
||||
arrow_style: ArrowStyle = "filled"
|
||||
|
||||
def __post_init__(self) -> None:
|
||||
if self.arrow_style not in {"open", "half", "filled"}:
|
||||
raise ValueError(f"Unknown connection arrow style: {self.arrow_style}")
|
||||
|
||||
|
||||
# This is the intentional code-level styling point for every port/connection type.
|
||||
CONNECTION_STYLES: dict[str, ConnectionStyle] = {
|
||||
"signal": ConnectionStyle(),
|
||||
"power": ConnectionStyle(width=3.0, arrow_style="half", color="#000000"),
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user