Mercurial > MadButterfly
changeset 1291:a3e04b3f2a8c
Add clone function for domview
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sat, 15 Jan 2011 20:57:42 +0800 |
parents | 922d1caf6632 |
children | 00833f8912a9 |
files | pyink/domview.py |
diffstat | 1 files changed, 19 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/pyink/domview.py Sat Jan 15 20:48:03 2011 +0800 +++ b/pyink/domview.py Sat Jan 15 20:57:42 2011 +0800 @@ -757,5 +757,24 @@ dst_group.append(child) pass pass + + ## \brief Clone children of a source group to a destinate group. + # + # It create a 'svg:use' node for every child of the source group, + # and append nodes to the desitnate group. + # + def clone_group_children(self, src_group, dst_group): + doc = self._doc + + for src_child in src_group.childList(): + src_child_id = src_child.getAttribute('id') + dst_child_id = self.new_id() + + dst_child = doc.createElement('svg:use') + dst_child.setAttribute('xlink:href', '#' + src_child_id) + dst_child.setAttribute('id', dst_child_id) + dst_group.append(child) + pass + pass pass