svg_utils icon indicating copy to clipboard operation
svg_utils copied to clipboard

"copy()" deepcopys "self.root" not "self", leading to unexpected behaviour not in line with documentation

Open Quwertzuiopp opened this issue 4 years ago • 2 comments

Like the title says, copying e.g. a svgutils.transform.GroupElement returns a lxml.etree._Element, not a new GroupElement. That means that if you try to copy an Element instead of reading it from disk again, the function does not return a copy of the Element, like the documentation says.

Honestly, I don't understand how this could ever be the desired behavior. This way, if you want to include the same SVG twice on two different spots of the figure, you need to pass the result of copy to the appropriate constructor before you can move it.

So I propose that either the documentation should reflect this, or the behaviour should be changed to be in line with what you would naturally expect.

Quwertzuiopp avatar Jan 31 '21 15:01 Quwertzuiopp

hi @Quwertzuiopp, thanks for the report! I agree that the expected behaviour would be the copy of svgutils class not the lxml base. Please feel free to submit a PR!

btel avatar Feb 09 '21 22:02 btel

@btel can I take this up (If no one is working on this)?

Saransh-cpp avatar Sep 28 '21 16:09 Saransh-cpp