Skip to content

Port to KiCad 10 (fixes #87 and #86)#89

Open
ETM-Code wants to merge 1 commit into
MitjaNemec:V9from
ETM-Code:V10-pr
Open

Port to KiCad 10 (fixes #87 and #86)#89
ETM-Code wants to merge 1 commit into
MitjaNemec:V9from
ETM-Code:V10-pr

Conversation

@ETM-Code
Copy link
Copy Markdown

Port to KiCad 10 (fixes #87 and #86)

Based on V9, one focused commit. Keeps the diff small — no committed build
artifacts or reference data.

#87 — plugin raises on every run under KiCad 10

KiCad 10 removed the pcbnew.ID_V_TOOLBAR constant that
action_replicate_layout.py used 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 uses ID_V_TOOLBAR when it
exists (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() (a PCB_GROUP object)
directly to the expected group name (a string), which is always unequal, so the
plugin aborted with a LookupError whenever a destination footprint was already in
a group (e.g. re-running over a previously grouped layout). Now compares the group's
name.

Other small changes

  • metadata_source.json: kicad_version10.0, kicad_version_max10.99.
  • version.txt5.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 — the
    script copied them into the package but never generated them. (Generated *_GUI.py
    remain gitignored, as before.)

Testing

test_replicate_layout.py is rewritten into a working, GUI-free suite driven through
the 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.

<KiCad python> test_replicate_layout.py     # 11 tests, OK on 9.0.9 and 10.0.3

The suite can also capture reference signatures with --gen-refs under one KiCad
version 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.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReplicateLayout under KiCAD 10

1 participant