Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify import_svg API #838

Merged
merged 4 commits into from
Jan 14, 2025
Merged

simplify import_svg API #838

merged 4 commits into from
Jan 14, 2025

Conversation

snoyer
Copy link
Contributor

@snoyer snoyer commented Dec 30, 2024

Importing an SVG file from Inkscape using the labels set from the "Layers and Objects" panel currently requires passing both label_by="label" and is_inkscape_label=True to import_svg().

This PR proposes to remove the is_inkscape_label parameter and allow using label_by="inkscape:label" (matching the attribute as it appears in the XML: <path d="..." inkscape:label="foo" />)

The implementation is basically handling the inkscape: prefix in the label_by values as a shortcut for the actual {http://www.inkscape.org/namespaces/inkscape} namespace.
This should be future-proof enough to handle more shortcuts for other software in addition to Inkscape if the need arises (as opposed to adding more use_xxx_label: bool parameters as per the current approach)

Copy link

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.34%. Comparing base (25181f4) to head (393d64e).
Report is 72 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #838      +/-   ##
==========================================
- Coverage   96.98%   96.34%   -0.65%     
==========================================
  Files          31       31              
  Lines        8901     9129     +228     
==========================================
+ Hits         8633     8795     +162     
- Misses        268      334      +66     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gumyr gumyr requested a review from jdegenstein December 30, 2024 18:53
Copy link
Collaborator

@jdegenstein jdegenstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@gumyr gumyr merged commit f9afe1f into gumyr:dev Jan 14, 2025
19 of 20 checks passed
@gumyr
Copy link
Owner

gumyr commented Jan 14, 2025

Thank you!

@snoyer snoyer deleted the simplify-import_svg-api branch January 15, 2025 01:16
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.

3 participants