diff --git a/src/wireviz/templates/connector.html b/src/wireviz/templates/connector.html
index bcddf9c..c7a3395 100644
--- a/src/wireviz/templates/connector.html
+++ b/src/wireviz/templates/connector.html
@@ -7,11 +7,28 @@
| {{ designator }} |
-
+ {% if bom_id %}
+ BOM: {{ bom_id }} |
+ {% endif %}
+
+ {% if line_pn %}
+
+
+
+
+ {% for item in line_pn %}
+ | {{item}} |
+ {% endfor %}
+
+
+ |
+
+ {% endif %}
+
|
|
+
+ {% if image %}
+
+ |
+ {% include "images.html" %}
+ |
+
+ {% endif %}
+
+ {% if line_notes %}
+
+ |
+
+ |
+
+ {% endif %}
diff --git a/src/wireviz/templates/images.html b/src/wireviz/templates/images.html
new file mode 100644
index 0000000..963f2e2
--- /dev/null
+++ b/src/wireviz/templates/images.html
@@ -0,0 +1,16 @@
+{% if image %}
+
+
+  |
+
+ {% if image.caption %}
+
+ |
+ {{ image.caption }}
+ |
+
+ {% endif %}
+
+{% else %}
+
+{% endif %}
diff --git a/src/wireviz/wv_graphviz.py b/src/wireviz/wv_graphviz.py
index 4c870d7..8bec8e0 100644
--- a/src/wireviz/wv_graphviz.py
+++ b/src/wireviz/wv_graphviz.py
@@ -46,6 +46,35 @@ def gv_pin_row(pin, connector) -> Tr:
]
return Tr(cells)
+def image_and_caption_cells(component: Component) -> (Td, Td):
+ if not component.image:
+ return (None, None)
+
+ image_tag = Img(scale=component.image.scale, src=component.image.src)
+ image_cell_inner = Td(image_tag, flat=True)
+ if component.image.fixedsize:
+ # further nest the image in a table with width/height/fixedsize parameters,
+ # and place that table in a cell
+ image_cell = Td(
+ Table(Tr(image_cell_inner), border=0, cellborder=0, cellspacing=0, id="!")
+ )
+ else:
+ image_cell = image_cell_inner
+
+ image_cell.update_attribs(
+ balign="left",
+ bgcolor=component.image.bgcolor.html,
+ sides="TLR" if component.image.caption else None,
+ )
+
+ if component.image.caption:
+ caption_cell = Td(
+ f"{html_line_breaks(component.image.caption)}", balign="left", sides="BLR"
+ )
+ else:
+ caption_cell = None
+ return (image_cell, caption_cell)
+
def gv_node_connector(connector: Connector) -> Table:
pins = []
use_left = bool(connector.ports_left)
@@ -64,10 +93,12 @@ def gv_node_connector(connector: Connector) -> Table:
'has_pincolors': has_pincolors,
})
columns = 2 + (1 if use_left else 0) + (1 if use_right else 0)
+ # TODO: group per line/item
params = {
'designator': f"{remove_links(connector.designator)}",
'use_left': use_left,
'use_right': use_right,
+ 'line_pn': partnumbers2list(connector.partnumbers),
'pins': pins,
'columns': columns,
'bom_id': connector.bom_entry.id,
@@ -78,6 +109,8 @@ def gv_node_connector(connector: Connector) -> Table:
'show_pincount': connector.show_pincount,
'color': connector.color,
'color_len': len(connector.color),
+ 'image': connector.image,
+ 'line_notes': html_line_breaks(connector.notes),
}
# TODO: extend connector style support
is_simple_connector = connector.style == 'simple'
@@ -522,52 +555,6 @@ def color_minitable(color: Optional[MultiColor]) -> Union[Table, str]:
)
-def image_and_caption_cells(component: Component) -> (Td, Td):
- if not component.image:
- return (None, None)
-
- image_tag = Img(scale=component.image.scale, src=component.image.src)
- image_cell_inner = Td(image_tag, flat=True)
- if component.image.fixedsize:
- # further nest the image in a table with width/height/fixedsize parameters,
- # and place that table in a cell
- image_cell_inner.update_attribs(**html_size_attr_dict(component.image))
- image_cell = Td(
- Table(Tr(image_cell_inner), border=0, cellborder=0, cellspacing=0, id="!")
- )
- else:
- image_cell = image_cell_inner
-
- image_cell.update_attribs(
- balign="left",
- bgcolor=component.image.bgcolor.html,
- sides="TLR" if component.image.caption else None,
- )
-
- if component.image.caption:
- caption_cell = Td(
- f"{html_line_breaks(component.image.caption)}", balign="left", sides="BLR"
- )
- else:
- caption_cell = None
- return (image_cell, caption_cell)
-
-
-def html_size_attr_dict(image):
- # Return Graphviz HTML attributes to specify minimum or fixed size of a TABLE or TD object
- pass
-
- attr_dict = {}
- if image:
- if image.width:
- attr_dict["width"] = image.width
- if image.height:
- attr_dict["height"] = image.height
- if image.fixedsize:
- attr_dict["fixedsize"] = "true"
- return attr_dict
-
-
def set_dot_basics(dot, options):
dot.body.append(f"// Graph generated by {APP_NAME} {__version__}\n")
dot.body.append(f"// {APP_URL}\n")