Implemented the group_connectors option of the internal BoM
This commit is contained in:
parent
2ef0aa060c
commit
6b9be4a2fc
|
|
@ -37,7 +37,7 @@ DNC = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def compare_value(c1, c2):
|
def compare_value(c1, c2, cfg):
|
||||||
""" Compare the value of two components """
|
""" Compare the value of two components """
|
||||||
# Simple string comparison
|
# Simple string comparison
|
||||||
if c1.value.lower() == c2.value.lower():
|
if c1.value.lower() == c2.value.lower():
|
||||||
|
|
@ -46,10 +46,11 @@ def compare_value(c1, c2):
|
||||||
if compare_values(c1.value, c2.value):
|
if compare_values(c1.value, c2.value):
|
||||||
return True
|
return True
|
||||||
# Ignore value if both components are connectors
|
# Ignore value if both components are connectors
|
||||||
# TODO
|
# Note: Is common practice to use the "Value" field of connectors to denote its use.
|
||||||
# if group_connectors:
|
# In this case the values won't match even when the connectors are equivalent.
|
||||||
# if 'connector' in self.getLibName().lower() and 'connector' in other.getLibName().lower():
|
if cfg.group_connectors:
|
||||||
# return True
|
if 'connector' in c1.lib.lower() and 'connector' in c2.lib.lower():
|
||||||
|
return True
|
||||||
# No match, return False
|
# No match, return False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
@ -92,7 +93,7 @@ def compare_components(c1, c2, cfg):
|
||||||
for c in cfg.group_fields:
|
for c in cfg.group_fields:
|
||||||
# Perform special matches
|
# Perform special matches
|
||||||
if c == ColumnList.COL_VALUE_L:
|
if c == ColumnList.COL_VALUE_L:
|
||||||
if not compare_value(c1, c2):
|
if not compare_value(c1, c2, cfg):
|
||||||
return False
|
return False
|
||||||
# Match part name
|
# Match part name
|
||||||
elif c == ColumnList.COL_PART_L:
|
elif c == ColumnList.COL_PART_L:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue