diff 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
line wrap: on
line diff
--- a/pyink/domview.py	Tue Jan 11 17:24:56 2011 +0800
+++ b/pyink/domview.py	Tue Jan 11 17:39:06 2011 +0800
@@ -524,6 +524,10 @@
     def get_layer_num(self):
 	return len(self._layers)
 
+    ## \brief Find layer index and scene info for a given scene node.
+    #
+    # \return (-1, None) for error.
+    #
     def find_layer_n_scene_of_node(self, node_id):
 	for layer_idx, layer in enumerate(self._layers):
 	    for scene_node in layer.scenes:
@@ -569,6 +573,17 @@
 	
 	return dup_group
 
+    ## \brief Return associated layer index of given layer group.
+    #
+    # \return -1 for error.
+    #
+    def find_layer_of_group(self, group_id):
+        for layer_idx, layer in enumerate(self._layers):
+            if layer.group.getAttribute('id') == group_id:
+                return layer_idx
+            pass
+        return -1
+
     def insert_frames(self, layer_idx, frame_idx, num):
 	layer = self._layers[layer_idx]
 	for scene_node in layer.scenes: