inkex.elements._utils module#

Useful utilities specifically for elements (that aren’t base classes)

New in version 1.1: Most of the methods in this module were moved from inkex.utils.

inkex.elements._utils.registerNS(prefix, url)[source]#

Register the given prefix as a namespace url.

inkex.elements._utils.addNS(tag, ns=None, namespaces=NSS)[source]#

Add a known namespace to a name for use with lxml

inkex.elements._utils.removeNS(name, reverse_namespaces=SSN, default='svg')[source]#

The reverse of addNS, finds any namespace and returns tuple (ns, tag)

inkex.elements._utils.splitNS(name, namespaces=NSS)[source]#

Like removeNS, but returns a url instead of a prefix

inkex.elements._utils.natural_sort_key(key, _nsre=re.compile('([0-9]+)'))[source]#

Helper for a natural sort, see https://stackoverflow.com/a/16090640/3298143

class inkex.elements._utils.ChildToProperty(tag, prepend=False)[source]#

Bases: property

class inkex.elements._utils.CloningVat(svg)[source]#

Bases: object

When modifying defs, sometimes we want to know if every backlink would have needed changing, or it was just some of them.

This tracks the def elements, their promises and creates clones if needed.

track(elem, parent, set_id=None, **kwargs)[source]#

Track the element and connected parent

process(process, types=(), make_clones=True, **kwargs)[source]#

Process each tracked item if the backlinks match the parents

Optionally make clones, process the clone and set the new id.