-
Notifications
You must be signed in to change notification settings - Fork 139
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
Fixed #16 #20
Fixed #16 #20
Conversation
Groups are now taken into account during parsing and transform attributes of groups are applied to the paths before they are returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @alphanoob1337 I take it you're somewhat new at contributing to open source projects -- that's ok, me too :) Also I want to say I'm psyched that you're contributing svgpathtools.
That said there are some major problems with this pull-request:
-
(OK this one is pretty minor) the fork you made this pull-request from is out of date. Thus if I merge your pull-request it will undo some recent work. Take a look at the diff.
-
It looks like you changed a lot more than necessary. There's nothing wrong with this, but how well tested is your code? Why should I trust your code is well tested?
You've chosen to add to a portion of svgpathtools that is currently very poorly covered by unittests (but well-tested by extensive use), that means any changes you make need to be carefully vetted.
Generally speaking, if the code you add/alter in a pull-request is more than a line or two, you should probably include thorough unittests to test the changes (or make sure there are unittests that already exist doing this). unittests are also a great way to explain to others working on a project what you think the expected behavior of a feature should be.
If you want to avoid adding unittests for existing functionality, then try to keep the impact your code potentially has to current features to a minimum.
- svgpathtools adheres quite closesly to PEP 8 standards.
Your code is far from PEP 8 standards. PyCharm does a great job flagging stylistic errors and makes renaming variables and functions quite simple.
If you want I'm happy to do this part for you, but if you want the contribution credit (that listed automatically by GitHub), email me the code when you're ready to redo your pull-request and I'll e-mail it back fixed-up.
Thanks again for your contributing! It's awesome to have developers like you helping out.
-Andy
Hi Andy, thanks for that answer! It is actually my first contribution to opensource software so I appreciate the guidance a lot. I will have a look at PyCharms and tests for the code on the weekend. I am not sure if I can publish the SVGs I had for testing, so I will create new ones. I think it is better if I learn the whole process of contributing for the future. Cheers |
Transformation bugs fixed.
Hi Andy, Changes made as requested. Created an example SVG to test the transformations. Cheers |
I think that this i a good begin for handling group transformation. But that doesn't handle concatinated transform attribute. To do this done you could try something like that:
so you can just put it on each path element later. I don't tested the code, just write it down from my head. I am shure that this looks ugly and I think you have to update some other parts to. May be I get a working peace in few days. |
Took me three minutes longer than you to fix it ;-) . I chose a very simmilar approach although I did not use recursion but put the parsing in a for loop. |
Hi @mathandy, Today I tried to address your first point (my fork not being up to date). When I tried to make a pull request on my fork with your master branch, I got
When I switch the base, only my changes are shown to me in the comparison. Can you please make a pull request on my fork with the changes it would undo when merging with yours? The 27 lines of yours that are missing in my fork are intentionally deleted by me. Cheers |
svgpathtools/svg2paths.py
Outdated
""" | ||
if os_path.dirname(svg_file_location) == '': | ||
svg_file_location = os_path.join(getcwd(), svg_file_location) | ||
|
||
# if pathless_svg: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These commented out lines, for example, were removed in a recent update.
@alphanoob1337 sorry, I don't follow. I see your pull-requests, so what weren't you able to do? Were you unable to find the recent updates your code was missing? I pointed out one to help, but you should just download current zip and diff your I see you added some unittests, that's great! A couple notes:
Why not just keep track of the transformations and which paths they affect and then apply the transformations after all the svg elements are converted to Perhaps it actually makes more sense to include the group attributes in the attributes dictionary for the path, but that would require some verification of the rules (when group attributes override element attributes or vise-versa). This brings up some questions though...
Here's an example group attributes being overridden by path attributes and interacting transforms:
|
… of master branch in svgpathtools.
HI @alphanoob1337 , I'm going to close this pull request. If you're still interested in adding support for groups or group transform attributes in specific, let's have a conversation about how to best go about it under the issue #16 . |
Groups are now taken into account during parsing and transform attributes of groups are applied to the paths before they are returned.