Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional image and caption attributes to Connector and Cable/Bundle nodes #137

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion examples/ex08.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,18 @@ connectors:
pins: [T, R, S]
pinlabels: [Dot, Dash, Ground]
show_pincount: false
image: ../resources/stereo-phone-plug-TRS.png
caption: Tip, Ring, and Sleeve

cables:
W1:
gauge: 24 AWG
length: 0.2
color_code: DIN
wirecount: 3
shield: true
shield: SN
image: ../resources/cable-WH+BN+GN+shield.png
caption: Cross-section

connections:
-
Expand Down
Binary file added resources/cable-WH+BN+GN+shield.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/stereo-phone-plug-TRS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions src/wireviz/DataClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class Connector:
type: Optional[str] = None
subtype: Optional[str] = None
pincount: Optional[int] = None
image: Optional[str] = None
image_scale: Optional[str] = "FALSE"
image_size: List[Any] = field(default_factory=list)
caption: Optional[str] = None
notes: Optional[str] = None
pinlabels: List[Any] = field(default_factory=list)
pins: List[Any] = field(default_factory=list)
Expand Down Expand Up @@ -88,8 +92,13 @@ class Cable:
gauge_unit: Optional[str] = None
show_equiv: bool = False
length: float = 0
color: Optional[str] = None
wirecount: Optional[int] = None
shield: bool = False
image: Optional[str] = None
image_scale: Optional[str] = "FALSE"
image_size: List[Any] = field(default_factory=list)
caption: Optional[str] = None
notes: Optional[str] = None
colors: List[Any] = field(default_factory=list)
color_code: Optional[str] = None
Expand Down Expand Up @@ -149,8 +158,6 @@ def __post_init__(self):
else:
raise Exception('lists of part data are only supported for bundles')

# for BOM generation
self.wirecount_and_shield = (self.wirecount, self.shield)

def connect(self, from_name, from_pin, via_pin, to_name, to_pin):
from_pin = int2tuple(from_pin)
Expand Down
Loading