Repository navigation
Fix DNP and variant fields being ignored with field case normalization - #588
Open
DominikPalo wants to merge 1 commit into
Open
DominikPalo wants to merge 1 commit into
DominikPalo wants to merge 1 commit into
Conversation
With normalize_field_case, extra field names are lowercased in the component data, but the dialog and --dnp-field / --variant-field keep the original case (e.g. "DNP"). skip_component looked the names up as-is, so DNP parts stayed in the BOM, a variant whitelist excluded everything and a variant blacklist did nothing. Lowercase both names before the lookup, like generate_bom already does for shown fields. The settings dialog had the same problem when listing the values of the selected variant field, so the whitelist/blacklist choices came up empty. Lowercase the selection there too, and since normalization drops empty values, offer <empty> for components without the field, matching how skip_component treats them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
qu1ck
requested changes
Oct 7, 2026
Comment on lines
+370
to
+371
| if selection in field_dict or normalize: | ||
| v = field_dict.get(selection, "") |
Member
There was a problem hiding this comment.
Don't invent empty value if field is not set.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With "Normalize field name case" /
--normalize-field-caseenabled,EcadParser.normalize_field_nameslowercases the keys of each component's extra fields (e.g.DNP→dnp), but the field names offered in the dialog and passed via--dnp-field/--variant-fieldkeep their original case.generate_bomalready accounts for this when looking up shown fields (field.lower()), but two other lookups did not.skip_component(core/ibom.py)It looked up
config.dnp_fieldandconfig.board_variant_fieldas-is, so with normalization on:Both names are now lowercased before the lookup when
normalize_field_caseis set.--variant-fielddefaults toNonerather than'', so the lowercasing is guarded.FieldsPanel.OnBoardVariantFieldChange(dialog/settings_dialog.py)It had the same mismatch when collecting the values of the selected variant field, so the whitelist/blacklist choices came up empty with normalization on. The selection is now lowercased too.
Normalization also drops empty values (
remapkeeps only truthy values). In normalized mode the dialog therefore treats a missing key as empty and offers<empty>, which matches howskip_componenttreats such components. With normalization off, behavior is unchanged.Testing
Copy of the KiCad Arduino_Uno template with fields added via pcbnew:
DNP=yeson J2, andVariant= A / B / A / (empty) on J1 / J2 / J3 / J4. CLI run with KiCad's Python, mounting holes blacklisted:--dnp-field DNP--dnp-field DNP --normalize-field-case--variant-field Variant --variants-whitelist A --normalize-field-case--variant-field Variant --variants-blacklist B --normalize-field-case--variant-field Variant --variants-whitelist "A,<empty>" --dnp-field DNPDialog: I instantiated the real
SettingsDialogwith KiCad's wxPython, loaded the board as extra data, selectedVariantas the variant field and read the whitelist items:<empty>, A, B<empty>, A, B<empty>, A, BNot addressed here: when the dialog opens,
set_extra_data_pathparses the extra data beforetransfer_to_dialogrestores a saved "normalize case" setting. That is a separate ordering issue.🤖 Generated with Claude Code