Streamline assignment of ports to simple connectors
This commit is contained in:
parent
94f9d96197
commit
8200e891d0
@ -18,10 +18,7 @@ from wireviz.DataClasses import (
|
||||
Tweak,
|
||||
)
|
||||
from wireviz.svgembed import embed_svg_images_file
|
||||
from wireviz.wv_bom import (
|
||||
bom_list,
|
||||
generate_bom,
|
||||
)
|
||||
from wireviz.wv_bom import bom_list, generate_bom
|
||||
from wireviz.wv_gv_html import (
|
||||
apply_dot_tweaks,
|
||||
calculate_node_bgcolor,
|
||||
@ -32,10 +29,7 @@ from wireviz.wv_gv_html import (
|
||||
parse_arrow_str,
|
||||
set_dot_basics,
|
||||
)
|
||||
from wireviz.wv_helper import (
|
||||
open_file_write,
|
||||
tuplelist2tsv,
|
||||
)
|
||||
from wireviz.wv_helper import open_file_write, tuplelist2tsv
|
||||
from wireviz.wv_html import generate_html_output
|
||||
|
||||
|
||||
|
||||
@ -49,10 +49,7 @@ def gv_node_component(
|
||||
|
||||
if isinstance(component, Connector):
|
||||
line_info = [
|
||||
Td(
|
||||
html_line_breaks(component.type),
|
||||
port="p1l" if is_simple_connector else None,
|
||||
),
|
||||
html_line_breaks(component.type),
|
||||
html_line_breaks(component.subtype),
|
||||
f"{component.pincount}-pin" if component.show_pincount else None,
|
||||
translate_color(component.color, harness_options.color_mode),
|
||||
@ -96,7 +93,14 @@ def gv_node_component(
|
||||
]
|
||||
|
||||
tbl = nested_table(lines)
|
||||
tbl.update_attribs(port="p1r" if is_simple_connector else None)
|
||||
if is_simple_connector:
|
||||
# Simple connectors have no pin table, and therefore, no ports to attach wires to.
|
||||
# Manually assign left and right ports here if required.
|
||||
# Use table itself for right port, and the first cell for left port.
|
||||
# Even if the table only has one cell, two separate ports can still be assigned.
|
||||
tbl.update_attribs(port="p1r")
|
||||
first_cell_in_tbl = tbl.contents[0].contents
|
||||
first_cell_in_tbl.update_attribs(port="p1l")
|
||||
|
||||
return tbl
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user