Fix node rendering for cables with hidden name and/or no visible attributes (#104)
Closes #69.
This commit is contained in:
parent
a418005c2e
commit
b028e7a22b
@ -163,23 +163,25 @@ class Harness:
|
|||||||
f'{cable.length} m' if cable.length > 0 else '']
|
f'{cable.length} m' if cable.length > 0 else '']
|
||||||
attributes = list(filter(None, attributes))
|
attributes = list(filter(None, attributes))
|
||||||
|
|
||||||
html = '<table border="0" cellspacing="0" cellpadding="0"><tr><td>' # main table
|
html = '<table border="0" cellspacing="0" cellpadding="0">' # main table
|
||||||
|
|
||||||
html = f'{html}<table border="0" cellspacing="0" cellpadding="3" cellborder="1">' # name+attributes table
|
if cable.show_name or len(attributes) > 0:
|
||||||
if cable.show_name:
|
html = f'{html}<tr><td><table border="0" cellspacing="0" cellpadding="3" cellborder="1">' # name+attributes table
|
||||||
html = f'{html}<tr><td colspan="{len(attributes)}">{cable.name}</td></tr>'
|
if cable.show_name:
|
||||||
if(len(identification) > 0): # print an identification row if values specified
|
html = f'{html}<tr><td colspan="{max(len(attributes), 1)}">{cable.name}</td></tr>'
|
||||||
html = f'{html}<tr><td colspan="{len(attributes)}" cellpadding="0"><table border="0" cellspacing="0" cellpadding="3" cellborder="1"><tr>'
|
if(len(identification) > 0): # print an identification row if values specified
|
||||||
for attrib in identification[0:-1]:
|
html = f'{html}<tr><td colspan="{len(attributes)}" cellpadding="0"><table border="0" cellspacing="0" cellpadding="3" cellborder="1"><tr>'
|
||||||
html = f'{html}<td sides="R">{attrib}</td>' # all columns except last have a border on the right (sides="R")
|
for attrib in identification[0:-1]:
|
||||||
if len(identification) > 0:
|
html = f'{html}<td sides="R">{attrib}</td>' # all columns except last have a border on the right (sides="R")
|
||||||
html = f'{html}<td border="0">{identification[-1]}</td>' # last column has no border on the right because the enclosing table borders it
|
if len(identification) > 0:
|
||||||
html = f'{html}</tr></table></td></tr>' # end identification row
|
html = f'{html}<td border="0">{identification[-1]}</td>' # last column has no border on the right because the enclosing table borders it
|
||||||
html = f'{html}<tr>' # attribute row
|
html = f'{html}</tr></table></td></tr>' # end identification row
|
||||||
for attrib in attributes:
|
if(len(attributes) > 0):
|
||||||
html = f'{html}<td balign="left">{attrib}</td>'
|
html = f'{html}<tr>' # attribute row
|
||||||
html = f'{html}</tr>' # attribute row
|
for attrib in attributes:
|
||||||
html = f'{html}</table></td></tr>' # name+attributes table
|
html = f'{html}<td balign="left">{attrib}</td>'
|
||||||
|
html = f'{html}</tr>' # attribute row
|
||||||
|
html = f'{html}</table></td></tr>' # name+attributes table
|
||||||
|
|
||||||
html = f'{html}<tr><td> </td></tr>' # spacer between attributes and wires
|
html = f'{html}<tr><td> </td></tr>' # spacer between attributes and wires
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user