From 6b9be4a2fc85e597cce2916f58bcf249c5ba85cb Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Sat, 1 Aug 2020 16:06:54 -0300 Subject: [PATCH] Implemented the group_connectors option of the internal BoM --- kiplot/bom/bom.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kiplot/bom/bom.py b/kiplot/bom/bom.py index ea60c042..859fdd0b 100644 --- a/kiplot/bom/bom.py +++ b/kiplot/bom/bom.py @@ -37,7 +37,7 @@ DNC = { } -def compare_value(c1, c2): +def compare_value(c1, c2, cfg): """ Compare the value of two components """ # Simple string comparison if c1.value.lower() == c2.value.lower(): @@ -46,10 +46,11 @@ def compare_value(c1, c2): if compare_values(c1.value, c2.value): return True # Ignore value if both components are connectors - # TODO - # if group_connectors: - # if 'connector' in self.getLibName().lower() and 'connector' in other.getLibName().lower(): - # return True + # Note: Is common practice to use the "Value" field of connectors to denote its use. + # In this case the values won't match even when the connectors are equivalent. + if cfg.group_connectors: + if 'connector' in c1.lib.lower() and 'connector' in c2.lib.lower(): + return True # No match, return False return False @@ -92,7 +93,7 @@ def compare_components(c1, c2, cfg): for c in cfg.group_fields: # Perform special matches if c == ColumnList.COL_VALUE_L: - if not compare_value(c1, c2): + if not compare_value(c1, c2, cfg): return False # Match part name elif c == ColumnList.COL_PART_L: