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'
|
fontname: PlainText = 'arial'
|
||||||
bgcolor: Color = 'WH'
|
bgcolor: Color = 'WH'
|
||||||
bgcolor_node: Optional[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'
|
color_mode: ColorMode = 'SHORT'
|
||||||
mini_bom_mode: bool = True
|
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
|
@dataclass
|
||||||
class Image:
|
class Image:
|
||||||
|
|||||||
@ -102,7 +102,7 @@ class Harness:
|
|||||||
shape='none',
|
shape='none',
|
||||||
width='0', height='0', margin='0', # Actual size of the node is entirely determined by the label.
|
width='0', height='0', margin='0', # Actual size of the node is entirely determined by the label.
|
||||||
style='filled',
|
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)
|
fontname=self.options.fontname)
|
||||||
dot.attr('edge', style='bold',
|
dot.attr('edge', style='bold',
|
||||||
fontname=self.options.fontname)
|
fontname=self.options.fontname)
|
||||||
@ -170,7 +170,8 @@ class Harness:
|
|||||||
html = [row.replace('<!-- connector table -->', '\n'.join(pinhtml)) for row in html]
|
html = [row.replace('<!-- connector table -->', '\n'.join(pinhtml)) for row in html]
|
||||||
|
|
||||||
html = '\n'.join(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:
|
if len(connector.loops) > 0:
|
||||||
dot.attr('edge', color='#000000:#ffffff:#000000')
|
dot.attr('edge', color='#000000:#ffffff:#000000')
|
||||||
@ -337,9 +338,11 @@ class Harness:
|
|||||||
to_string = ''
|
to_string = ''
|
||||||
html = [row.replace(f'<!-- {connection.via_port}_out -->', to_string) for row in html]
|
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)
|
html = '\n'.join(html)
|
||||||
dot.node(cable.name, label=f'<\n{html}\n>', shape='box',
|
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
|
return dot
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user