Mercurial > MadButterfly
comparison pyink/domview.py @ 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 | 082fff7e9604 |
comparison
equal
deleted
inserted
replaced
1286:922d1caf6632 | 1291:a3e04b3f2a8c |
---|---|
755 for child in dup_group.childList(): | 755 for child in dup_group.childList(): |
756 dup_group.removeChild(child) # prevent from crash | 756 dup_group.removeChild(child) # prevent from crash |
757 dst_group.append(child) | 757 dst_group.append(child) |
758 pass | 758 pass |
759 pass | 759 pass |
760 | |
761 ## \brief Clone children of a source group to a destinate group. | |
762 # | |
763 # It create a 'svg:use' node for every child of the source group, | |
764 # and append nodes to the desitnate group. | |
765 # | |
766 def clone_group_children(self, src_group, dst_group): | |
767 doc = self._doc | |
768 | |
769 for src_child in src_group.childList(): | |
770 src_child_id = src_child.getAttribute('id') | |
771 dst_child_id = self.new_id() | |
772 | |
773 dst_child = doc.createElement('svg:use') | |
774 dst_child.setAttribute('xlink:href', '#' + src_child_id) | |
775 dst_child.setAttribute('id', dst_child_id) | |
776 dst_group.append(child) | |
777 pass | |
778 pass | |
760 pass | 779 pass |
761 | 780 |