From 23c17e66bf60ba55d33aff05ff12c5dfe24e318b Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Mon, 27 Jul 2020 10:21:00 +0200 Subject: [PATCH] Change wire padding behavior Addresses #131 --- src/wireviz/Harness.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 5952e0e9..9cc6b96d 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -139,6 +139,10 @@ def create_graph(self) -> Graph: dot.edge(f'{connector.name}:p{loop[0]}{loop_side}:{loop_dir}', f'{connector.name}:p{loop[1]}{loop_side}:{loop_dir}') + # determine if there are double- or triple-colored wires in the harness; + # if so, pad single-color wires to make all wires of equal thickness + pad = any(len(colorstr) > 2 for cable in self.cables.values() for colorstr in cable.colors) + for _, cable in self.cables.items(): awg_fmt = '' @@ -187,11 +191,6 @@ def create_graph(self) -> Graph: html = f'{html}' # conductor table - # determine if there are double- or triple-colored wires; - # if so, pad single-color wires to make all wires of equal thickness - colorlengths = list(map(len, cable.colors)) - pad = 4 in colorlengths or 6 in colorlengths - for i, connection_color in enumerate(cable.colors, 1): p = [] p.append(f'')