Implement additional parameters dict for components
This commit is contained in:
parent
8c1d2773a3
commit
00d5271f0c
@ -311,6 +311,7 @@ class TopLevelGraphicalComponent(GraphicalComponent): # abstract class
|
|||||||
designator: Designator = None
|
designator: Designator = None
|
||||||
color: Optional[MultiColor] = None
|
color: Optional[MultiColor] = None
|
||||||
image: Optional[Image] = None
|
image: Optional[Image] = None
|
||||||
|
additional_parameters: Optional[Dict] = None
|
||||||
additional_components: List[AdditionalComponent] = field(default_factory=list)
|
additional_components: List[AdditionalComponent] = field(default_factory=list)
|
||||||
notes: Optional[MultilineHypertext] = None
|
notes: Optional[MultilineHypertext] = None
|
||||||
# BOM options
|
# BOM options
|
||||||
|
|||||||
@ -62,6 +62,11 @@ def gv_node_component(component: Component) -> Table:
|
|||||||
str(component.color) if component.color else None,
|
str(component.color) if component.color else None,
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if component.additional_parameters:
|
||||||
|
line_additional_parameters = nested_table_dict(component.additional_parameters)
|
||||||
|
else:
|
||||||
|
line_additional_parameters = []
|
||||||
|
|
||||||
if component.color:
|
if component.color:
|
||||||
line_info.extend(colorbar_cells(component.color))
|
line_info.extend(colorbar_cells(component.color))
|
||||||
|
|
||||||
@ -81,6 +86,7 @@ def gv_node_component(component: Component) -> Table:
|
|||||||
line_name,
|
line_name,
|
||||||
line_pn,
|
line_pn,
|
||||||
line_info,
|
line_info,
|
||||||
|
line_additional_parameters,
|
||||||
line_ports,
|
line_ports,
|
||||||
line_image,
|
line_image,
|
||||||
line_image_caption,
|
line_image_caption,
|
||||||
@ -215,6 +221,13 @@ def nested_table(lines: List[Td]) -> Table:
|
|||||||
return tbl
|
return tbl
|
||||||
|
|
||||||
|
|
||||||
|
def nested_table_dict(d: dict) -> Table:
|
||||||
|
rows = []
|
||||||
|
for k, v in d.items():
|
||||||
|
rows.append(Tr([Td(k, align="left", balign="left", valign="top"), Td(html_line_breaks(v), align="left", balign="left")]))
|
||||||
|
return Table(rows, border=0, cellborder=1, cellpadding=3, cellspacing=0)
|
||||||
|
|
||||||
|
|
||||||
def gv_pin_table(component) -> Table:
|
def gv_pin_table(component) -> Table:
|
||||||
pin_rows = []
|
pin_rows = []
|
||||||
for pin in component.pin_objects.values():
|
for pin in component.pin_objects.values():
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user