Comment 5 for bug 1693578

Revision history for this message
su_v (suv-lp) wrote :

The proposed patch from comment #3 does drop (i.e. not preserve) any XML comments within the ungrouped groups (inkscape does that too, when ungrouping "manually"). I briefly investigated a different solution which preserves comments as such, but unfortunately, Inkscape (0.92.x) gets (temporarily) confused about the stack order when reloading a document returned from an extension where comments have been moved from inside a group to SVG Root (this can be reproduced independent of ungroup_deep.py). Reloading the file after saving though shows the expected result (and behavior).

While not really usable/applicable at the moment, I'm attaching that other diff too (for discussion maybe, or potentially for a future version of Inkscape which better handles reloading content with re-stacked XML comments). It only supports python2 (no 'basestring' in python3).

With regard to the original test case: 'Deep Ungroup' currently does not support preserving presentation attributes inherited from parent groups (as opposed to inline CSS style properties). This is not related to the bug reported/tracked here (failure due to attempting to process etree.Comment as etree.Element); and can be worked around by forcing an update of the drawing content (e.g. nudging the top-level group, which triggers Inkscape to rewrite presentation attributes as inline CSS style properties) before applying the extension. Those style properties defined on parent groups are then processed as expected by 'Deep Ungroup'.