Skip to content

Move all serialisation to KicadFileHandler.py

This is a follow-up to !1024 (merged) which added a few new node types. However, because the serialisation was distributed around the new files, it caused some need for import trickery to avoid circular imports (and also other classes calling "private" methods of the serialiser). It also maintains the current division of concerns (the nodes don't need to worry about how they're serialised, just that they provide an API that allows "some" serialiser to get what it needs), and allows for code sharing - especially probably useful in the Pad and NativeCPad, which are very similar.

This just moves the serialisation into the main serialiser class, mostly wholesale with only needed adjustments. No tests exist for this code.

Plus a couple of tidy-ups:

  • CRLF -> LF in one file
  • Removing some commented-up very-dead code that was since removed in the other serialisers (to do with new lines s-expressions, which are no longer manually added at this point in the serialisation)
  • Avoiding baking in KiCad s-expr constants to the API of the NativeCPad corner selection

A test is added on the most complicated class (NativeCPad), though test only a trivial fraction, as the setup is extremely complicated and there are many different ways to construct things.

Edited by John Beard

Merge request reports

Loading