Skip to content

Commit

Permalink
Add a caption attribute to both Connectors and Cables
Browse files Browse the repository at this point in the history
  • Loading branch information
kvid committed Aug 3, 2020
1 parent c06a6dd commit b903863
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 @@ -19,6 +19,7 @@ class Connector:
subtype: Optional[str] = None
pincount: Optional[int] = None
image: Optional[str] = None
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 @@ -92,6 +93,7 @@ class Cable:
wirecount: Optional[int] = None
shield: bool = False
image: Optional[str] = None
caption: 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 @@ -97,6 +97,7 @@ def create_graph(self) -> Graph:
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.caption)],
[html_line_breaks(connector.notes)]]
html = nested_html_table(rows)

Expand Down Expand Up @@ -246,6 +247,8 @@ def create_graph(self) -> Graph:
html = f'{html}</td></tr>' # main table
if cable.image:
html = f'{html}<tr><td cellpadding="3"><IMG SRC="{cable.image}"/></td></tr>'
if cable.caption:
html = f'{html}<tr><td cellpadding="3" balign="left">{html_line_breaks(cable.caption)}</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 b903863

Please sign in to comment.