changeset 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
files pyink/domview.py
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/domview.py	Sat Jan 15 18:32:33 2011 +0800
+++ b/pyink/domview.py	Sat Jan 15 20:48:03 2011 +0800
@@ -705,18 +705,13 @@
 	    
 	    if end < frame_idx:
 		continue
-
+            
 	    if start > last_rm:	# this scene is at right side
 		self.chg_scene_node(scene_node,
 				    start=(start - num),
 				    end=(end - num))
-	    elif start >= frame_idx:
-	        self.rm_scene_node_n_group(scene_node)
-	        pass
 	    else:	 # this scene is covered by removing range
-		self.chg_scene_node(scene_node,
-				    start=start,
-				    end=(end - num))
+                self.rm_scene_node_n_group(scene_node)
 		pass
 	    pass
 	pass
@@ -731,12 +726,15 @@
     def copy_group_children(self, src_group, dst_group):
 	# Search for the duplicated group
 	doc = self._doc
+        
+        dup_group = src_group.duplicate(doc)
+        
 	old_nodes = _DOM_iterator(src_group)
+        new_nodes = _DOM_iterator(dup_group)
         new_gids = set()
 	for old_node in old_nodes:
 	    old_node_id = old_node.getAttribute('id')
-	    new_node = doc.createElement("svg:use")
-	    new_node.setAttribute("xlink:href",'#'+old_node_id)
+            new_node = new_nodes.next()
 	    new_node.setAttribute('ns0:duplicate-src', old_node_id)
             
             #
@@ -752,8 +750,12 @@
                 pass
             new_gids.add(gid)
             new_node.setAttribute('id', gid)
-	    dst_group.appendChild(new_node)
 	    pass
+
+        for child in dup_group.childList():
+            dup_group.removeChild(child) # prevent from crash
+            dst_group.append(child)
+            pass
 	pass
     pass