From b028e7a22b4a1faacd97b42581c30665220d5ce1 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Mon, 20 Jul 2020 14:24:39 +0200 Subject: [PATCH] Fix node rendering for cables with hidden name and/or no visible attributes (#104) Closes #69. --- src/wireviz/Harness.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index b866390..b980483 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -163,23 +163,25 @@ class Harness: f'{cable.length} m' if cable.length > 0 else ''] attributes = list(filter(None, attributes)) - html = '' # name+attributes table + if cable.show_name or len(attributes) > 0: + html = f'{html}' # name+attributes table html = f'{html}' # spacer between attributes and wires
' # main table + html = '' # main table - html = f'{html}
' # name+attributes table - if cable.show_name: - html = f'{html}' - if(len(identification) > 0): # print an identification row if values specified - html = f'{html}' # end identification row - html = f'{html}' # attribute row - for attrib in attributes: - html = f'{html}' - html = f'{html}' # attribute row - html = f'{html}
{cable.name}
' - for attrib in identification[0:-1]: - html = f'{html}' # all columns except last have a border on the right (sides="R") - if len(identification) > 0: - html = f'{html}' # last column has no border on the right because the enclosing table borders it - html = f'{html}
{attrib}{identification[-1]}
{attrib}
' # name+attributes table + if cable.show_name: + html = f'{html}' + if(len(identification) > 0): # print an identification row if values specified + html = f'{html}' # end identification row + if(len(attributes) > 0): + html = f'{html}' # attribute row + for attrib in attributes: + html = f'{html}' + html = f'{html}' # attribute row + html = f'{html}
{cable.name}
' + for attrib in identification[0:-1]: + html = f'{html}' # all columns except last have a border on the right (sides="R") + if len(identification) > 0: + html = f'{html}' # last column has no border on the right because the enclosing table borders it + html = f'{html}
{attrib}{identification[-1]}
{attrib}