Fixed columns capitalization.

Now the capitalization is preserved, even when internally we match all
using lowercase.
This commit is contained in:
Salvador E. Tropea 2020-07-31 20:08:12 -03:00
parent 8a5c3724a1
commit ca67cc8ac3
2 changed files with 5 additions and 2 deletions

View File

@ -149,6 +149,7 @@ class ComponentGroup(object):
self.cfg = cfg
# Columns loaded from KiCad
self.fields = {c.lower(): None for c in ColumnList.COLUMNS_DEFAULT}
self.field_names = ColumnList.COLUMNS_DEFAULT
def match_component(self, c):
""" Test if a given component fits in this group """
@ -210,12 +211,14 @@ class ComponentGroup(object):
""" Update a given field, concatenates existing values and informs a collision """
if not value:
return
field_ori = field
field = field.lower()
# Exclude the ones we handle in special ways
if field in ColumnList.COLUMNS_PROTECTED_L:
return
if (field not in self.fields) or (not self.fields[field]):
self.fields[field] = value
self.field_names.append(field_ori)
elif value.lower() in self.fields[field].lower():
return
else:
@ -433,7 +436,7 @@ def do_bom(file_name, ext, comps, cfg):
# Read out all available fields
# TODO: get cached from the list?
for g in groups:
for f in g.fields:
for f in g.field_names:
columns.add_column(f)
# Don't add 'boards' column if only one board is specified
# TODO: Shouldn't be the other way (add if needed)

View File

@ -25,7 +25,7 @@ BOM_DIR = 'BoM'
REF_COLUMN_NAME = 'References'
QTY_COLUMN_NAME = 'Quantity Per PCB'
KIBOM_TEST_HEAD = ['Component', 'Description', 'Part', REF_COLUMN_NAME, 'Value', 'Footprint', QTY_COLUMN_NAME, 'Datasheet',
'config']
'Config']
KIBOM_TEST_COMPONENTS = ['C1', 'C2', 'C3', 'C4', 'R1', 'R2', 'R3', 'R4', 'R5', 'R7', 'R8', 'R9', 'R10']
KIBOM_TEST_EXCLUDE = ['R6']
KIBOM_TEST_GROUPS = 5