Port to KiCad 10 (fixes #87 and #86)#89
Open
ETM-Code wants to merge 1 commit into
Open
Conversation
…tjaNemec#86) KiCad 10 support (MitjaNemec#87) - KiCad 10 removed pcbnew.ID_V_TOOLBAR, which action_replicate_layout.py used to position the dialog; the plugin raised on every run. Add get_dialog_position() which uses the toolbar id when present (KiCad 9) and otherwise falls back to the right edge of the editor frame (KiCad 10). - metadata_source.json: kicad_version 10.0 / max 10.99; version.txt -> 5.0.0. - deprecation_dialog_GUI.fbp: the old text said the plugin would not be ported to KiCad 10; replaced with an accurate notice. - make_a_package.sh: also generate the conn_issue and deprecation GUIs (they were copied into the package but never generated). - The replication core is unchanged: the SWIG API it uses is unchanged in KiCad 10 (only removed in KiCad 11). Verified byte-identical to KiCad 9 (see Testing). Grouped-destination crash (MitjaNemec#86) - The destination-group precheck compared a PCB_GROUP object to a string, which is always unequal, so the plugin aborted whenever a destination footprint was already in a group. Compare the group name instead. Testing - Rewrite test_replicate_layout.py into a working, GUI-free suite driven through the pcbnew scripting API (the previous tests referenced absent folders and had the comparison commented out). Nine replication scenarios plus MitjaNemec#86 regressions, each checked for convention-independent geometric correctness. test_helpers.py added.
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.
Port to KiCad 10 (fixes #87 and #86)
Based on
V9, one focused commit. Keeps the diff small — no committed buildartifacts or reference data.
#87 — plugin raises on every run under KiCad 10
KiCad 10 removed the
pcbnew.ID_V_TOOLBARconstant thataction_replicate_layout.pyused to position the dialog next to the right toolbar,so the plugin threw immediately and showed the error dialog instead of the UI.
Fix: a small
get_dialog_position()helper that still usesID_V_TOOLBARwhen itexists (KiCad 9) and otherwise falls back to the right edge of the PCB editor frame
(KiCad 10). No exceptions on either version.
The replication core needs no changes — the SWIG pcbnew API it uses is unchanged
in KiCad 10 (only slated for removal in KiCad 11). I verified this by running the
existing logic under both KiCad 9.0.9 and KiCad 10.0.3 and getting byte-identical
geometry.
#86 — fails when destination footprints are already grouped
The destination-group precheck compared
GetParentGroup()(aPCB_GROUPobject)directly to the expected group name (a string), which is always unequal, so the
plugin aborted with a
LookupErrorwhenever a destination footprint was already ina group (e.g. re-running over a previously grouped layout). Now compares the group's
name.
Other small changes
metadata_source.json:kicad_version→10.0,kicad_version_max→10.99.version.txt→5.0.0.deprecation_dialog_GUI.fbp: the old text said the plugin would not be ported toKiCad 10; replaced with an accurate notice.
make_a_package.sh: also generate theconn_issueanddeprecationGUIs — thescript copied them into the package but never generated them. (Generated
*_GUI.pyremain gitignored, as before.)
Testing
test_replicate_layout.pyis rewritten into a working, GUI-free suite driven throughthe pcbnew scripting API (the previous tests referenced project folders that aren't in
the repo and had the board comparison commented out). It runs nine replication
scenarios (inner/outer levels, flipped anchor, contained vs. intersecting,
remove-existing, grouping, footprint text) plus #86 regressions, and checks each
result for geometric correctness — every replicated section must keep the same
internal geometry (pairwise distances, relative orientation, relative flip) as the
source, independent of any coordinate convention.
The suite can also capture reference signatures with
--gen-refsunder one KiCadversion and diff against them under another to prove byte-for-byte parity (that's how
KiCad 9 → 10 parity was confirmed); those references are left out of the PR to keep it
small.
All four dialogs were also confirmed to construct under KiCad 10's wxPython, the
plugin loads/registers in the KiCad 10 PCB editor, and the full flow (run from
Tools ▸ External Plugins → dialog → replicate) was exercised live in KiCad 10.0.3.