Skip to content

Commit

Permalink
Add an image attribute to both Connectors and Cables
Browse files Browse the repository at this point in the history
  • Loading branch information
kvid committed Jul 29, 2020
1 parent 23c17e6 commit d93c2eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/wireviz/DataClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Connector:
type: Optional[str] = None
subtype: Optional[str] = None
pincount: Optional[int] = None
image: 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 @@ -90,6 +91,7 @@ class Cable:
length: float = 0
wirecount: Optional[int] = None
shield: bool = False
image: Optional[str] = None
notes: Optional[str] = None
colors: List[Any] = field(default_factory=list)
color_code: Optional[str] = None
Expand Down
3 changes: 3 additions & 0 deletions src/wireviz/Harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def create_graph(self) -> Graph:
f'{connector.pincount}-pin' if connector.show_pincount else None,
connector.color, '<!-- colorbar -->' if connector.color else None],
'<!-- connector table -->' if connector.style != 'simple' else None,
[f'<IMG SRC="{connector.image}"/>' if connector.image else None],
[html_line_breaks(connector.notes)]]
html = nested_html_table(rows)

Expand Down Expand Up @@ -243,6 +244,8 @@ def create_graph(self) -> Graph:
html = f'{html}</table>' # conductor table

html = f'{html}</td></tr>' # main table
if cable.image:
html = f'{html}<tr><td><IMG SRC="{cable.image}"/></td></tr>'
if cable.notes:
html = f'{html}<tr><td cellpadding="3" balign="left">{html_line_breaks(cable.notes)}</td></tr>' # notes table
html = f'{html}<tr><td>&nbsp;</td></tr>' # spacer at the end
Expand Down

0 comments on commit d93c2eb

Please sign in to comment.