Add an image_scale attribute to both Connectors and Cables
It specifies how an image will use any extra space available in its cell. Allowed values are one of these strings: - FALSE : keep image its natural size. (Default) - TRUE : scale image uniformly to fit. - WIDTH : expand image width to fill. - HEIGHT : expand image height to fill. - BOTH : expand both image width and height to fill. The value is sent to Graphviz as a scale attribute to the <img> tag. Note that there is normally no extra height in the image cell.
This commit is contained in:
parent
00b4d726c0
commit
335f42112c
@ -19,6 +19,7 @@ class Connector:
|
||||
subtype: Optional[str] = None
|
||||
pincount: Optional[int] = None
|
||||
image: Optional[str] = None
|
||||
image_scale: Optional[str] = "FALSE"
|
||||
caption: Optional[str] = None
|
||||
notes: Optional[str] = None
|
||||
pinlabels: List[Any] = field(default_factory=list)
|
||||
@ -94,6 +95,7 @@ class Cable:
|
||||
wirecount: Optional[int] = None
|
||||
shield: bool = False
|
||||
image: Optional[str] = None
|
||||
image_scale: Optional[str] = "FALSE"
|
||||
caption: Optional[str] = None
|
||||
notes: Optional[str] = None
|
||||
colors: List[Any] = field(default_factory=list)
|
||||
|
||||
@ -56,7 +56,9 @@ def nested_html_table(rows):
|
||||
return html
|
||||
|
||||
def html_image(node):
|
||||
return f'''<tdX{' sides="TLR"' if node.caption else ''}><img src="{node.image}"/>''' if node.image else None
|
||||
if not node.image:
|
||||
return None
|
||||
return f'''<tdX{' sides="TLR"' if node.caption else ''}><img scale="{node.image_scale}" src="{node.image}"/>'''
|
||||
|
||||
def html_caption(node):
|
||||
return f'''<tdX{' sides="LRB"' if node.image else ''}>{html_line_breaks(node.caption)}''' if node.caption else None
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user