Add options bgcolor_connector, bgcolor_cable, and bgcolor_bundle
This commit is contained in:
parent
15d7374399
commit
b5e3d0a4ce
@ -42,9 +42,22 @@ class Options:
|
||||
fontname: PlainText = 'arial'
|
||||
bgcolor: Color = 'WH'
|
||||
bgcolor_node: Optional[Color] = 'WH'
|
||||
bgcolor_connector: Optional[Color] = None
|
||||
bgcolor_cable: Optional[Color] = None
|
||||
bgcolor_bundle: Optional[Color] = None
|
||||
color_mode: ColorMode = 'SHORT'
|
||||
mini_bom_mode: bool = True
|
||||
|
||||
def __post_init__(self):
|
||||
if not self.bgcolor_node:
|
||||
self.bgcolor_node = self.bgcolor
|
||||
if not self.bgcolor_connector:
|
||||
self.bgcolor_connector = self.bgcolor_node
|
||||
if not self.bgcolor_cable:
|
||||
self.bgcolor_cable = self.bgcolor_node
|
||||
if not self.bgcolor_bundle:
|
||||
self.bgcolor_bundle = self.bgcolor_cable
|
||||
|
||||
|
||||
@dataclass
|
||||
class Image:
|
||||
|
||||
@ -102,7 +102,7 @@ class Harness:
|
||||
shape='none',
|
||||
width='0', height='0', margin='0', # Actual size of the node is entirely determined by the label.
|
||||
style='filled',
|
||||
fillcolor=wv_colors.translate_color(self.options.bgcolor_node or self.options.bgcolor, "HEX"),
|
||||
fillcolor=wv_colors.translate_color(self.options.bgcolor_node, "HEX"),
|
||||
fontname=self.options.fontname)
|
||||
dot.attr('edge', style='bold',
|
||||
fontname=self.options.fontname)
|
||||
@ -170,7 +170,8 @@ class Harness:
|
||||
html = [row.replace('<!-- connector table -->', '\n'.join(pinhtml)) for row in html]
|
||||
|
||||
html = '\n'.join(html)
|
||||
dot.node(connector.name, label=f'<\n{html}\n>')
|
||||
dot.node(connector.name, label=f'<\n{html}\n>', shape='box', style='filled',
|
||||
fillcolor=translate_color(self.options.bgcolor_connector, "HEX"))
|
||||
|
||||
if len(connector.loops) > 0:
|
||||
dot.attr('edge', color='#000000:#ffffff:#000000')
|
||||
@ -337,9 +338,11 @@ class Harness:
|
||||
to_string = ''
|
||||
html = [row.replace(f'<!-- {connection.via_port}_out -->', to_string) for row in html]
|
||||
|
||||
style, bgcolor = ('filled,dashed', self.options.bgcolor_bundle) if cable.category == 'bundle' else \
|
||||
('filled', self.options.bgcolor_cable)
|
||||
html = '\n'.join(html)
|
||||
dot.node(cable.name, label=f'<\n{html}\n>', shape='box',
|
||||
style='filled,dashed' if cable.category == 'bundle' else 'filled')
|
||||
style=style, fillcolor=translate_color(bgcolor, "HEX"))
|
||||
|
||||
return dot
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user