[KiBoM] Added support for Mouser links

This commit is contained in:
Salvador E. Tropea 2022-11-07 11:34:14 -03:00
parent be84d10968
commit a4e68b1c18
4 changed files with 14 additions and 0 deletions

View File

@ -2300,6 +2300,7 @@ Notes:
- `regex`: [string=''] Regular expression to match.
- *regexp*: Alias for regex.
- `merge_blank_fields`: [boolean=true] Component groups with blank fields will be merged into the most compatible group, where possible.
- `mouser_link`: [string|list(string)=''] Column/s containing Mouser part numbers, will be linked to web page (HTML only).
- `ref_separator`: [string=' '] Separator used for the list of references.
- `test_regex`: [boolean=true] Each component group will be tested against a number of regular-expressions (see ``)..
- `use_alt`: [boolean=false] Print grouped references in the alternate compressed style eg: R1-R7,R18.

View File

@ -1081,6 +1081,8 @@ outputs:
# `regexp` is an alias for `regex`
# [boolean=true] Component groups with blank fields will be merged into the most compatible group, where possible
merge_blank_fields: true
# [string|list(string)=''] Column/s containing Mouser part numbers, will be linked to web page (HTML only)
mouser_link: ''
# [boolean=true] First column is the row number
number_rows: true
# [string=' '] Separator used for the list of references

View File

@ -124,6 +124,8 @@ class KiBoMConfig(Optionable):
""" Separator used for the list of references """
self.digikey_link = Optionable
""" [string|list(string)=''] Column/s containing Digi-Key part numbers, will be linked to web page (HTML only) """
self.mouser_link = Optionable
""" [string|list(string)=''] Column/s containing Mouser part numbers, will be linked to web page (HTML only) """
self.group_fields = GroupFields
""" *[list(string)] List of fields used for sorting individual components into groups.
Components which match (comparing *all* fields) will be grouped together.
@ -222,6 +224,11 @@ class KiBoMConfig(Optionable):
self.digikey_link = None
elif isinstance(self.digikey_link, list):
self.digikey_link = '\t'.join(self.digikey_link)
# mouser_link
if isinstance(self.mouser_link, type):
self.mouser_link = None
elif isinstance(self.mouser_link, list):
self.mouser_link = '\t'.join(self.mouser_link)
# group_fields
if isinstance(self.group_fields, type):
self.group_fields = None
@ -318,6 +325,7 @@ class KiBoMConfig(Optionable):
self.write_bool('hide_pcb_info')
self.write_str('ref_separator')
self.write_str('digikey_link')
self.write_str('mouser_link')
# Ask to keep the output name
f.write('output_file_name = %O\n')
self.write_vector(self.group_fields, 'GROUP_FIELDS')

View File

@ -14,6 +14,9 @@ outputs:
digikey_link:
- digikey#
- digikey_alt#
mouser_link:
- mouser#
- mouser_alt#
component_aliases:
- ['r', 'r_small', 'res', 'resistor']
- - 'l'