Remove vertical separators in BOM table

This commit is contained in:
Daniel Rojas 2021-03-23 12:15:03 +01:00
parent f928bc73ca
commit aaf88d7601
2 changed files with 17 additions and 2 deletions

View File

@ -31,14 +31,20 @@ def get_additional_component_table(harness: "Harness", component: Union[Connecto
columns = [] columns = []
if harness.show_bom_item_numbers: if harness.show_bom_item_numbers:
columns.append(bom_bubble(id)) columns.append(bom_bubble(id))
columns.append(f'{part.qty * component.get_qty_multiplier(part.qty_multiplier)}' + (f' {part.unit}' if part.unit else ' x')) columns.append(f'{part.qty * component.get_qty_multiplier(part.qty_multiplier)}' + (f' {part.unit}' if part.unit else 'x'))
columns.append(f'{part.type}') columns.append(f'{part.type}')
if harness.show_part_numbers: if harness.show_part_numbers:
columns.append(f'P/N: {part.pn}' if part.pn else '') columns.append(f'P/N: {part.pn}' if part.pn else '')
columns.append(f'{manufacturer_str}' if manufacturer_str else '') columns.append(f'{manufacturer_str}' if manufacturer_str else '')
columns.append(f'{part.note}' if part.note else '') columns.append(f'{part.note}' if part.note else '')
rowstr = '\n <tr>\n' + ''.join([f' <td align="left" balign="left">{html_line_breaks(col)}</td>\n' for col in columns]) + ' </tr>' # TODO: Remove empty columns
rowstr = '\n <tr>\n'
for index, column in enumerate(columns):
sides = "tbl" if index == 0 else "tbr" if index == len(columns) -1 else "tb"
rowstr = rowstr + f' <td align="left" balign="left" sides="{sides}">{html_line_breaks(column)}</td>\n'
rowstr = rowstr + ' </tr>'
rows.append(rowstr) rows.append(rowstr)
pre = '<table border="0" cellspacing="0" cellpadding="3" cellborder="1">' pre = '<table border="0" cellspacing="0" cellpadding="3" cellborder="1">'

9
test/bomnumbertest.bom.tsv generated Normal file
View File

@ -0,0 +1,9 @@
Id Item Qty Unit Designators P/N Manufacturer MPN
1 Cable, 4 x 0.25 mm² 99 m W1 qwerty uiop
2 Connector, Plug, 4 pins 1 X1 123 ACME ABC
3 Connector, Receptacle, 4 pins 1 X2 234 ACME DEF
4 Crimp 1 X2 876 ACME WVU
5 Crimp 4 X1 987 ACME ZYX
6 Housing 1 X1 345 OTHER
7 Label 1 X1
8 Sleeving 5 m W1
1 Id Item Qty Unit Designators P/N Manufacturer MPN
2 1 Cable, 4 x 0.25 mm² 99 m W1 qwerty uiop
3 2 Connector, Plug, 4 pins 1 X1 123 ACME ABC
4 3 Connector, Receptacle, 4 pins 1 X2 234 ACME DEF
5 4 Crimp 1 X2 876 ACME WVU
6 5 Crimp 4 X1 987 ACME ZYX
7 6 Housing 1 X1 345 OTHER
8 7 Label 1 X1
9 8 Sleeving 5 m W1