Conversation
internal part number is now refered to as part number in bom
Tutorial changed to use short parn number field names Add aditional bom items to example
|
Looks good! You have my vote for the second option (merged fields). One minor thing: since we've moved P/N in front of the manufacturer info, let's do the same in the BOM, for consistency. Also, the exported BOM header still has the long names, please shorten. Thanks! |
src/wireviz/wv_helper.py
Outdated
| if manufacturer: | ||
| part_number_component = f': {mpn}' if mpn else '' | ||
| return(f'{manufacturer}{part_number_component}') | ||
| else: | ||
| return(f'MPN: {mpn}' if mpn else None) |
There was a problem hiding this comment.
How about this?
if manufacturer or mpn:
return f'{manufacturer if manufacturer else "MPN"}{": " + str(mpn) if mpn else ""}'
else
return NoneIt should return the same four options:
None (nothing specified)
{manufacturer} (no MPN specified)
MPN: {mpn} (no manufacturer specified)
{manufacturer}: {mpn} (both specified)
IMHO a bit cleaner and easier to understand.
The str() functions allows using + to concatenate strings without errors if mpn is passed as an int.
There was a problem hiding this comment.
@formatc1702 How about this alternative instead?
if manufacturer:
return f'{manufacturer}: {mpn}' if mpn else manufacturer
else:
return f'MPN: {mpn}' if mpn else NoneEdit: It's closer to the original, except without a variable and without parentheses around the return expressions.
There was a problem hiding this comment.
That looks like a much tider way to implement that, have swapped to that implementation in the latest commits
new order is part number manufacturer manufacturer part number
Also update BOM header generation to support specific headers for fields were capitalize produces unwanted output.
|
The changes in the above comments have been added, let me know if there are any other edits wanted. |
Fixes issue wireviz#129, but originally suggested in review of wireviz#121.
Fixes issue wireviz#129, but originally suggested in review of wireviz#121.
- Shorten `part_number` to `pn`
- Shorten `manufacturer_part_number` to `mpn`
- Show `manufacturer` and `mpn` in a single cell of the node
- Replace `manufacturer` with `'MPN'`within the node if no manufacturer is specified.
- Rearrange order of P/N fields within node
`{pn} | {manufacturer}: {mpn}`
This implements #114 commit b97e0ea implements the medged manufacturer and mpn fields examples of each are shown below this can be included or excluded from the merge depending on peoples opinion on which version looks better.
Seperated fields:

Merged fields:
