Closed SchrodingersGat closed 5 months ago
The recent changes enhance the import_meta_data
functionality within the KiCad Library Plugin by introducing a dedicated add_attachment
method to manage attachments for parts. This method now accommodates both modern and legacy attachment tables. Additionally, the get_datasheet
method in serializers.py
has been optimized to filter datasheets efficiently using case-insensitive matching, improving overall data handling.
Files/Paths | Change Summaries |
---|---|
inventree_kicad/KiCadLibraryPlugin.py |
Refactored import_meta_data to use a new add_attachment method. Supported handling for both modern and legacy attachment tables. Removed import of PartAttachment . |
inventree_kicad/serializers.py |
Updated get_datasheet to use case-insensitive filtering for datasheet comments, optimizing the logic. |
sequenceDiagram
participant User
participant KiCadLibraryPlugin
participant Part
participant PartAttachment (Modern)
participant PartAttachment (Legacy)
User ->> KiCadLibraryPlugin: import_meta_data(part)
KiCadLibraryPlugin ->>+ Part: Retrieve part details
KiCadLibraryPlugin ->>+ add_attachment: Handle attachments
add_attachment ->> PartAttachment (Modern): Add to modern table (if applicable)
add_attachment ->> PartAttachment (Legacy): Add to legacy table (if applicable)
PartAttachment (Modern) -->> KiCadLibraryPlugin: Attachment added
PartAttachment (Legacy) -->> KiCadLibraryPlugin: Attachment added
Note over KiCadLibraryPlugin,User: Attachment process complete
sequenceDiagram
participant User
participant serializers.py
participant Attachment
User ->> serializers.py: get_datasheet(part)
serializers.py ->>+ Attachment: Filter attachments by case-insensitive "datasheet"
Attachment -->> serializers.py: Return filtered datasheet
serializers.py -->> User: Returned datasheet
🐰 In code, we find a new delight,
As attachments now are handled right.
Modern or legacy, all in flow,
Improved, the datasheets now show.
With changes swift and filters keen,
Our library's efficiency clearly seen.
📚✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
This PR adds support for the "modern" attachments table in InvenTree, which uses a single database table to store all attachments.
Ref: https://github.com/inventree/InvenTree/pull/7420
Without this PR, the plugin breaks on any installation running off the
0.16.x
dev branch.Summary by CodeRabbit