diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..7a94ac7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,18 @@ +# Contribution Guidelines + +When contributing to this repository, please first discuss the change you +wish to make via issue, email, or any other method with the owners of this +repository before making a change. + +## Pull Requests + +1. Fork this repository to your repository +1. Clone the repository to your local machine +1. Checkout the `dev` branch +1. Make any changes to the code on the `dev` branch +1. Push your changes to your fork +1. Create new pull request + +## Documentation Strings + +Documentation strings are to follow the Google Style ([examples](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html)). diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 95e7a2a..3461cc9 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -4,7 +4,7 @@ from wireviz.DataClasses import Connector, Cable from graphviz import Graph from wireviz import wv_colors -from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, nested, \ +from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, \ nested_html_table, flatten2d, index_if_list, html_line_breaks, \ graphviz_line_breaks, remove_line_breaks from collections import Counter @@ -86,13 +86,11 @@ class Harness: for key, connector in self.connectors.items(): if connector.category == 'ferrule': - rows = [[html_line_breaks(connector.type), html_line_breaks(connector.subtype), connector.color, '' if connector.color else None], - [connector.manufacturer, + rows = [[connector.manufacturer, f'MPN: {connector.manufacturer_part_number}' if connector.manufacturer_part_number else None, f'IPN: {connector.internal_part_number}' if connector.internal_part_number else None], + [html_line_breaks(connector.type), html_line_breaks(connector.subtype), connector.color, '' if connector.color else None], [html_line_breaks(connector.notes)]] - rows = [list(filter(None, row)) for row in rows] # remove missing attributes - html = nested_html_table(rows) if connector.color: # add color bar next to color info, if present @@ -102,24 +100,37 @@ class Harness: dot.node(key, label=f'<{html}>', shape='none', margin='0', style='filled', fillcolor='white') else: # not a ferrule - identification = [connector.manufacturer, - f'MPN: {connector.manufacturer_part_number}' if connector.manufacturer_part_number else '', - f'IPN: {connector.internal_part_number}' if connector.internal_part_number else ''] - attributes = [graphviz_line_breaks(connector.type), - graphviz_line_breaks(connector.subtype), - f'{connector.pincount}-pin' if connector.show_pincount else''] - pinouts = [[], [], []] + rows = [[connector.name if connector.show_name else None], + [connector.manufacturer, + f'MPN: {connector.manufacturer_part_number}' if connector.manufacturer_part_number else None, + f'IPN: {connector.internal_part_number}' if connector.internal_part_number else None], + [html_line_breaks(connector.type), + html_line_breaks(connector.subtype), + f'{connector.pincount}-pin' if connector.show_pincount else None], + '', + [html_line_breaks(connector.notes)]] + html = nested_html_table(rows) + + pinouts = [] for pinnumber, pinname in zip(connector.pinnumbers, connector.pinout): if connector.hide_disconnected_pins and not connector.visible_pins.get(pinnumber, False): continue - pinouts[1].append(pinname) - if connector.ports_left: - pinouts[0].append(f'
{pinnumber}') - if connector.ports_right: - pinouts[2].append(f'
{pinnumber}') - label = [connector.name if connector.show_name else '', identification, attributes, pinouts, graphviz_line_breaks(connector.notes)] - dot.node(key, label=nested(label)) + pinouts.append([f'
| |
| |
| {row} |