-
Notifications
You must be signed in to change notification settings - Fork 264
[WIP]Add connector image alignment #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -191,6 +191,12 @@ def create_graph(self) -> Graph: | |||||||||||||||||||||||||||||||||||||
| connector.ports_left = True # Use left side pins. | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| html = [] | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| image_rows = [] | ||||||||||||||||||||||||||||||||||||||
| if connector.image and connector.image.position != 'above': | ||||||||||||||||||||||||||||||||||||||
| image_rows = [[html_image(connector.image)], | ||||||||||||||||||||||||||||||||||||||
| [html_caption(connector.image)]] | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+194
to
+199
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| # fmt: off | ||||||||||||||||||||||||||||||||||||||
| rows = [[f'{html_bgcolor(connector.bgcolor_title)}{remove_links(connector.name)}' | ||||||||||||||||||||||||||||||||||||||
| if connector.show_name else None], | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -199,16 +205,23 @@ def create_graph(self) -> Graph: | |||||||||||||||||||||||||||||||||||||
| html_line_breaks(pn_info_string(HEADER_SPN, connector.supplier, connector.spn))], | ||||||||||||||||||||||||||||||||||||||
| [html_line_breaks(connector.type), | ||||||||||||||||||||||||||||||||||||||
| html_line_breaks(connector.subtype), | ||||||||||||||||||||||||||||||||||||||
| f'{connector.pincount}-pin' if connector.show_pincount else None, | ||||||||||||||||||||||||||||||||||||||
| f'{connector.pincount}-pin' if connector.show_pincount else None], | ||||||||||||||||||||||||||||||||||||||
| [html_caption(connector.image) if connector.image and connector.image.position == 'above' else None, | ||||||||||||||||||||||||||||||||||||||
| html_image(connector.image) if connector.image and connector.image.position == 'above' else None, | ||||||||||||||||||||||||||||||||||||||
| translate_color(connector.color, self.options.color_mode) if connector.color else None, | ||||||||||||||||||||||||||||||||||||||
| html_colorbar(connector.color)], | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+208
to
212
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Bugs:
Fix:
|
||||||||||||||||||||||||||||||||||||||
| '<!-- connector table -->' if connector.style != 'simple' else None, | ||||||||||||||||||||||||||||||||||||||
| [html_image(connector.image)], | ||||||||||||||||||||||||||||||||||||||
| [html_caption(connector.image)]] | ||||||||||||||||||||||||||||||||||||||
| '<!-- connector table -->' if connector.style != 'simple' else None] | ||||||||||||||||||||||||||||||||||||||
| # fmt: on | ||||||||||||||||||||||||||||||||||||||
| imagetable='' | ||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| if connector.image: | ||||||||||||||||||||||||||||||||||||||
| if connector.image.position == 'below' or connector.image.position is None: | ||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| rows += image_rows | ||||||||||||||||||||||||||||||||||||||
| else: | ||||||||||||||||||||||||||||||||||||||
| imagetable = ''.join(nested_html_table(image_rows, html_bgcolor_attr(connector.bgcolor))) | ||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| rows.extend(get_additional_component_table(self, connector)) | ||||||||||||||||||||||||||||||||||||||
| rows.append([html_line_breaks(connector.notes)]) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| html.extend(nested_html_table(rows, html_bgcolor_attr(connector.bgcolor))) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if connector.style != "simple": | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -217,18 +230,28 @@ def create_graph(self) -> Graph: | |||||||||||||||||||||||||||||||||||||
| '<table border="0" cellspacing="0" cellpadding="3" cellborder="1">' | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| for pinindex, (pinname, pinlabel, pincolor) in enumerate( | ||||||||||||||||||||||||||||||||||||||
| zip_longest( | ||||||||||||||||||||||||||||||||||||||
| firstpin = True | ||||||||||||||||||||||||||||||||||||||
| pincount = len(connector.pins) | ||||||||||||||||||||||||||||||||||||||
| if len(connector.pinlabels) > pincount: | ||||||||||||||||||||||||||||||||||||||
| pincount = len(connector.pinlabels) | ||||||||||||||||||||||||||||||||||||||
| if len(connector.pincolors) > pincount: | ||||||||||||||||||||||||||||||||||||||
| pincount = len(connector.pincolors) | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Bug:
Fix:
|
||||||||||||||||||||||||||||||||||||||
| for pinindex, (pinname, pinlabel, pincolor) in enumerate(zip_longest( | ||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| connector.pins, connector.pinlabels, connector.pincolors | ||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||||||||
| )): | ||||||||||||||||||||||||||||||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||||||||||||||
| connector.hide_disconnected_pins | ||||||||||||||||||||||||||||||||||||||
| and not connector.visible_pins.get(pinname, False) | ||||||||||||||||||||||||||||||||||||||
| ): | ||||||||||||||||||||||||||||||||||||||
| continue | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| pinhtml.append(" <tr>") | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if firstpin and connector.image and connector.image.position == 'left': | ||||||||||||||||||||||||||||||||||||||
| firstpin = False | ||||||||||||||||||||||||||||||||||||||
| pinhtml.append(f'<td rowspan="{pincount}">{imagetable}</td>') | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if connector.ports_left: | ||||||||||||||||||||||||||||||||||||||
| pinhtml.append(f' <td port="p{pinindex+1}l">{pinname}</td>') | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+250
to
256
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| if pinlabel: | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -248,6 +271,11 @@ def create_graph(self) -> Graph: | |||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if connector.ports_right: | ||||||||||||||||||||||||||||||||||||||
| pinhtml.append(f' <td port="p{pinindex+1}r">{pinname}</td>') | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| if firstpin and connector.image and connector.image.position == 'right': | ||||||||||||||||||||||||||||||||||||||
| firstpin = False | ||||||||||||||||||||||||||||||||||||||
| pinhtml.append( | ||||||||||||||||||||||||||||||||||||||
| f'<td rowspan="{pincount}">{imagetable}</td>') | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
272
to
+278
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||
| pinhtml.append(" </tr>") | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| pinhtml.append(" </table>") | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -713,3 +741,4 @@ def bom(self): | |||||||||||||||||||||||||||||||||||||
| if not self._bom: | ||||||||||||||||||||||||||||||||||||||
| self._bom = generate_bom(self) | ||||||||||||||||||||||||||||||||||||||
| return self._bom | ||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no need for allowing a
Nonevalue here. When aNonevalue always should be treated equally as a "below" value, then it's better to use the latter as the default value explicitly.