From eefea241a3fdd74f6d39f2f4a5cfebfa7818235c Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Mon, 10 Aug 2020 16:44:13 +0200 Subject: [PATCH] Add suggested changes --- src/wireviz/Harness.py | 15 ++++++--------- src/wireviz/wv_helper.py | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 6c99fa7..635fae9 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -103,7 +103,7 @@ class Harness: if connector.color: # add color bar next to color info, if present colorbar = f' bgcolor="{wv_colors.translate_color(connector.color, "HEX")}" width="4">' # leave out ' tag - html = [x.replace('>', colorbar) for x in html] + html = [row.replace('>', colorbar) for row in html] if connector.style != 'simple': pinhtml = [] @@ -123,8 +123,7 @@ class Harness: pinhtml.append('') - pinhtml = '\n'.join(pinhtml) - html = [x.replace('', pinhtml) for x in html] + html = [row.replace('', '\n'.join(pinhtml)) for row in html] html = '\n'.join(html) dot.node(connector.name, label=f'<\n{html}\n>', shape='none', margin='0', style='filled', fillcolor='white') @@ -179,7 +178,7 @@ class Harness: if cable.color: # add color bar next to color info, if present colorbar = f' bgcolor="{wv_colors.translate_color(cable.color, "HEX")}" width="4">' # leave out ' tag - html = [x.replace('>', colorbar) for x in html] + html = [row.replace('>', colorbar) for row in html] wirehtml = [] wirehtml.append('') # conductor table @@ -237,9 +236,7 @@ class Harness: wirehtml.append('') wirehtml.append('
 
') - wirehtml = '\n'.join(wirehtml) - - html = [x.replace('', wirehtml) for x in html] + html = [row.replace('', '\n'.join(wirehtml)) for row in html] # connections for connection_color in cable.connections: @@ -254,14 +251,14 @@ class Harness: code_left_2 = f'{cable.name}:w{connection_color.via_port}:w' dot.edge(code_left_1, code_left_2) from_string = f'{connection_color.from_name}:{connection_color.from_port}' if self.connectors[connection_color.from_name].show_name else '' - html = [x.replace(f'', from_string) for x in html] + html = [row.replace(f'', from_string) for row in html] if connection_color.to_port is not None: # connect to right code_right_1 = f'{cable.name}:w{connection_color.via_port}:e' to_port = f':p{connection_color.to_port}l' if self.connectors[connection_color.to_name].style != 'simple' else '' code_right_2 = f'{connection_color.to_name}{to_port}:w' dot.edge(code_right_1, code_right_2) to_string = f'{connection_color.to_name}:{connection_color.to_port}' if self.connectors[connection_color.to_name].show_name else '' - html = [x.replace(f'', to_string) for x in html] + html = [row.replace(f'', to_string) for row in html] html = '\n'.join(html) dot.node(cable.name, label=f'<\n{html}\n>', shape='box', diff --git a/src/wireviz/wv_helper.py b/src/wireviz/wv_helper.py index 457c6e8..102acea 100644 --- a/src/wireviz/wv_helper.py +++ b/src/wireviz/wv_helper.py @@ -47,9 +47,9 @@ def nested_html_table(rows): html.append('') html.append('') elif row is not None: - html.append(f'') - html.append(f'{row}') - html.append(f'') + html.append('') + html.append(row) + html.append('') html.append('') return html