Skip to content

Commit

Permalink
Add placeholder for add.comp. PN info
Browse files Browse the repository at this point in the history
  • Loading branch information
formatc1702 authored and kvid committed Aug 27, 2023
1 parent c442446 commit 40cd5dd
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/wireviz/wv_dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ def bom_amount(self) -> NumberAndUnit:
else:
return self.amount

@property
def has_pn_info(self) -> bool:
return any([self.pn, self.manufacturer, self.mpn, self.supplier, self.spn])


@dataclass
class AdditionalComponent(Component):
Expand Down
27 changes: 16 additions & 11 deletions src/wireviz/wv_graphviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,22 @@ def gv_additional_component_table(component):

rows = []
for subitem in component.additional_components:
rows.append(
Tr(
[
Td(bom_bubble(subitem.bom_id)),
Td(f"{subitem.bom_qty}", align="right"),
Td(f"{subitem.qty.unit if subitem.qty.unit else 'x'}", align="left"),
Td(f"{subitem.description}", align="left"),
Td(f"{subitem.note if subitem.note else ''}", align="left"),
]
)
)
firstline = [
Td(bom_bubble(subitem.bom_id)),
Td(f"{subitem.bom_qty}", align="right"),
Td(f"{subitem.qty.unit if subitem.qty.unit else 'x'}", align="left"),
Td(f"{subitem.description}", align="left"),
Td(f"{subitem.note if subitem.note else ''}", align="left"),
]
rows.append(Tr(firstline))

if subitem.has_pn_info:
secondline = [
Td("", colspan=3),
Td(f"# TODO PN string", align="left"), # TODO
Td(""),
]
rows.append(Tr(secondline))

return Table(rows, border=1, cellborder=0, cellpadding=3, cellspacing=0)

Expand Down

0 comments on commit 40cd5dd

Please sign in to comment.