mirror of https://github.com/rusefi/WireViz.git
Add color attribute to cables
This commit is contained in:
parent
2639c77360
commit
43f85aedb2
|
@ -88,6 +88,7 @@ class Cable:
|
||||||
gauge_unit: Optional[str] = None
|
gauge_unit: Optional[str] = None
|
||||||
show_equiv: bool = False
|
show_equiv: bool = False
|
||||||
length: float = 0
|
length: float = 0
|
||||||
|
color: Optional[str] = None
|
||||||
wirecount: Optional[int] = None
|
wirecount: Optional[int] = None
|
||||||
shield: bool = False
|
shield: bool = False
|
||||||
notes: Optional[str] = None
|
notes: Optional[str] = None
|
||||||
|
|
|
@ -163,11 +163,16 @@ class Harness:
|
||||||
f'{len(cable.colors)}x' if cable.show_wirecount else None,
|
f'{len(cable.colors)}x' if cable.show_wirecount else None,
|
||||||
f'{cable.gauge} {cable.gauge_unit}{awg_fmt}' if cable.gauge else None,
|
f'{cable.gauge} {cable.gauge_unit}{awg_fmt}' if cable.gauge else None,
|
||||||
'+ S' if cable.shield else None,
|
'+ S' if cable.shield else None,
|
||||||
f'{cable.length} m' if cable.length > 0 else None],
|
f'{cable.length} m' if cable.length > 0 else None,
|
||||||
|
cable.color, '<!-- colorbar -->' if cable.color else None],
|
||||||
'<!-- wire table -->',
|
'<!-- wire table -->',
|
||||||
[html_line_breaks(cable.notes)]]
|
[html_line_breaks(cable.notes)]]
|
||||||
html = nested_html_table(rows)
|
html = nested_html_table(rows)
|
||||||
|
|
||||||
|
if cable.color: # add color bar next to color info, if present
|
||||||
|
colorbar = f' bgcolor="{wv_colors.translate_color(cable.color, "HEX")}" width="4"></td>' # leave out '<td' from string to preserve any existing attributes of the <td> tag
|
||||||
|
html = html.replace('><!-- colorbar --></td>', colorbar)
|
||||||
|
|
||||||
wirehtml = '<table border="0" cellspacing="0" cellborder="0">' # conductor table
|
wirehtml = '<table border="0" cellspacing="0" cellborder="0">' # conductor table
|
||||||
wirehtml = f'{wirehtml}<tr><td> </td></tr>'
|
wirehtml = f'{wirehtml}<tr><td> </td></tr>'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue