Mercurial > MadButterfly
comparison pyink/domview.py @ 1286:922d1caf6632
Revert to changeset #0442ae9c2ac2 for domview.py.
- revert copy_group_children() and rm_frames() to #0442ae9c2ac2.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sat, 15 Jan 2011 20:48:03 +0800 |
parents | e2d2532c3115 |
children | 99de83340782 a3e04b3f2a8c |
comparison
equal
deleted
inserted
replaced
1285:e2d2532c3115 | 1286:922d1caf6632 |
---|---|
703 start, end, tween_type = \ | 703 start, end, tween_type = \ |
704 self.parse_one_scene(scene_node) | 704 self.parse_one_scene(scene_node) |
705 | 705 |
706 if end < frame_idx: | 706 if end < frame_idx: |
707 continue | 707 continue |
708 | 708 |
709 if start > last_rm: # this scene is at right side | 709 if start > last_rm: # this scene is at right side |
710 self.chg_scene_node(scene_node, | 710 self.chg_scene_node(scene_node, |
711 start=(start - num), | 711 start=(start - num), |
712 end=(end - num)) | 712 end=(end - num)) |
713 elif start >= frame_idx: | |
714 self.rm_scene_node_n_group(scene_node) | |
715 pass | |
716 else: # this scene is covered by removing range | 713 else: # this scene is covered by removing range |
717 self.chg_scene_node(scene_node, | 714 self.rm_scene_node_n_group(scene_node) |
718 start=start, | |
719 end=(end - num)) | |
720 pass | 715 pass |
721 pass | 716 pass |
722 pass | 717 pass |
723 | 718 |
724 def get_max_frame(self): | 719 def get_max_frame(self): |
729 # Duplicate children of a group, and append them to another group. | 724 # Duplicate children of a group, and append them to another group. |
730 # | 725 # |
731 def copy_group_children(self, src_group, dst_group): | 726 def copy_group_children(self, src_group, dst_group): |
732 # Search for the duplicated group | 727 # Search for the duplicated group |
733 doc = self._doc | 728 doc = self._doc |
729 | |
730 dup_group = src_group.duplicate(doc) | |
731 | |
734 old_nodes = _DOM_iterator(src_group) | 732 old_nodes = _DOM_iterator(src_group) |
733 new_nodes = _DOM_iterator(dup_group) | |
735 new_gids = set() | 734 new_gids = set() |
736 for old_node in old_nodes: | 735 for old_node in old_nodes: |
737 old_node_id = old_node.getAttribute('id') | 736 old_node_id = old_node.getAttribute('id') |
738 new_node = doc.createElement("svg:use") | 737 new_node = new_nodes.next() |
739 new_node.setAttribute("xlink:href",'#'+old_node_id) | |
740 new_node.setAttribute('ns0:duplicate-src', old_node_id) | 738 new_node.setAttribute('ns0:duplicate-src', old_node_id) |
741 | 739 |
742 # | 740 # |
743 # Change ID here, or inkscape would insert the node with | 741 # Change ID here, or inkscape would insert the node with |
744 # the same ID, and change it later to avoid duplication. | 742 # the same ID, and change it later to avoid duplication. |
750 while gid in new_gids: | 748 while gid in new_gids: |
751 gid = self.new_id() | 749 gid = self.new_id() |
752 pass | 750 pass |
753 new_gids.add(gid) | 751 new_gids.add(gid) |
754 new_node.setAttribute('id', gid) | 752 new_node.setAttribute('id', gid) |
755 dst_group.appendChild(new_node) | 753 pass |
756 pass | 754 |
755 for child in dup_group.childList(): | |
756 dup_group.removeChild(child) # prevent from crash | |
757 dst_group.append(child) | |
758 pass | |
757 pass | 759 pass |
758 pass | 760 pass |
759 | 761 |