comparison pyink/domview.py @ 1259:df474448364e

Add find_layer_from_group() for domview_ui
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 11 Jan 2011 17:39:06 +0800
parents 8755415b5e99
children bbd6bc0d079a
comparison
equal deleted inserted replaced
1258:2609b219703d 1259:df474448364e
522 pass 522 pass
523 523
524 def get_layer_num(self): 524 def get_layer_num(self):
525 return len(self._layers) 525 return len(self._layers)
526 526
527 ## \brief Find layer index and scene info for a given scene node.
528 #
529 # \return (-1, None) for error.
530 #
527 def find_layer_n_scene_of_node(self, node_id): 531 def find_layer_n_scene_of_node(self, node_id):
528 for layer_idx, layer in enumerate(self._layers): 532 for layer_idx, layer in enumerate(self._layers):
529 for scene_node in layer.scenes: 533 for scene_node in layer.scenes:
530 scene_group_id = scene_node.getAttribute('ref') 534 scene_group_id = scene_node.getAttribute('ref')
531 if scene_group_id == node_id: 535 if scene_group_id == node_id:
566 dup_group.setAttribute('style', '') 570 dup_group.setAttribute('style', '')
567 571
568 layer.group.appendChild(dup_group) 572 layer.group.appendChild(dup_group)
569 573
570 return dup_group 574 return dup_group
575
576 ## \brief Return associated layer index of given layer group.
577 #
578 # \return -1 for error.
579 #
580 def find_layer_of_group(self, group_id):
581 for layer_idx, layer in enumerate(self._layers):
582 if layer.group.getAttribute('id') == group_id:
583 return layer_idx
584 pass
585 return -1
571 586
572 def insert_frames(self, layer_idx, frame_idx, num): 587 def insert_frames(self, layer_idx, frame_idx, num):
573 layer = self._layers[layer_idx] 588 layer = self._layers[layer_idx]
574 for scene_node in layer.scenes: 589 for scene_node in layer.scenes:
575 start, end, tween_type = self._parse_one_scene(scene_node) 590 start, end, tween_type = self._parse_one_scene(scene_node)