Fixed "exclude_any" logic.
This commit is contained in:
parent
17b5e61a43
commit
4fa2267021
|
|
@ -693,11 +693,19 @@ class SchematicComponent(object):
|
|||
while line[0] == 'F':
|
||||
field = SchematicField.parse(line)
|
||||
name_lc = field.name.lower()
|
||||
# Add to the global collection
|
||||
if name_lc not in fields_lc:
|
||||
fields.append(field.name)
|
||||
fields_lc[name_lc] = 1
|
||||
# Add to the component
|
||||
comp.add_field(field)
|
||||
line = _get_line(f)
|
||||
# Fake 'Part' field
|
||||
field = SchematicField()
|
||||
field.name = 'part'
|
||||
field.value = comp.name
|
||||
field.number = -1
|
||||
comp.add_field(field)
|
||||
# Redundant pos
|
||||
if not line.startswith('\t'+str(comp.unit)):
|
||||
raise SchFileError('Missing component redundant position', line, _sch_line_number)
|
||||
|
|
|
|||
|
|
@ -192,6 +192,7 @@ class BoMOptions(BaseOptions):
|
|||
[ColumnList.COL_REFERENCE, '^FID'],
|
||||
[ColumnList.COL_PART, 'mount.*hole'],
|
||||
[ColumnList.COL_PART, 'solder.*bridge'],
|
||||
[ColumnList.COL_PART, 'solder.*jump'],
|
||||
[ColumnList.COL_PART, 'test.*point'],
|
||||
[ColumnList.COL_FP, 'test.*point'],
|
||||
[ColumnList.COL_FP, 'mount.*hole'],
|
||||
|
|
@ -296,6 +297,14 @@ class BoMOptions(BaseOptions):
|
|||
# Explicit selection
|
||||
return self.format.lower()
|
||||
|
||||
@staticmethod
|
||||
def _fix_ref_field(field):
|
||||
""" References -> Reference """
|
||||
col = field.lower()
|
||||
if col == ColumnList.COL_REFERENCE_L:
|
||||
col = col[:-1]
|
||||
return col
|
||||
|
||||
def config(self):
|
||||
super().config()
|
||||
self.format = self._guess_format()
|
||||
|
|
@ -334,11 +343,12 @@ class BoMOptions(BaseOptions):
|
|||
self.exclude_any = []
|
||||
for r in BoMOptions.DEFAULT_EXCLUDE:
|
||||
o = BoMRegex()
|
||||
o.column = r[0]
|
||||
o.column = self._fix_ref_field(r[0])
|
||||
o.regex = compile(r[1], flags=IGNORECASE)
|
||||
self.exclude_any.append(o)
|
||||
else:
|
||||
for r in self.exclude_any:
|
||||
r.column = self._fix_ref_field(r.column)
|
||||
r.regex = compile(r.regex, flags=IGNORECASE)
|
||||
# Columns
|
||||
self.column_rename = {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue