# HG changeset patch # User Thinker K.F. Li # Date 1295096262 -28800 # Node ID a3e04b3f2a8cca9c083e0ffb3c10d419cab8bb25 # Parent 922d1caf66326f56dec76a554a362095dc013f5a Add clone function for domview diff -r 922d1caf6632 -r a3e04b3f2a8c pyink/domview.py --- 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