diff pyink/domview_ui.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 2609b219703d
children 6177f5d0ef01
line wrap: on
line diff
--- a/pyink/domview_ui.py	Tue Jan 11 17:24:56 2011 +0800
+++ b/pyink/domview_ui.py	Tue Jan 11 17:39:06 2011 +0800
@@ -542,6 +542,9 @@
     def find_key_from_group(self, scene_group_id):
 	layer_idx, scene_node = \
 	    self._dom.find_layer_n_scene_of_node(scene_group_id)
+        if layer_idx == -1:
+            raise ValueError, \
+                'can not find the key for group %s' % (scene_group_id)
 	start, end, tween_name = self._dom._parse_one_scene(scene_node)
 	tween_type = self._tween_type_names.index(tween_name)
 	return layer_idx, (start, end, tween_type)
@@ -589,6 +592,15 @@
     def register_active_frame_callback(self, cb):
 	self._fl_stack.register_active_frame_callback(cb)
 	pass
+    
+    ## \brief Find the layer index associated with a given layer group.
+    #
+    def find_layer_from_group(self, group_id):
+        layer_idx = self._domview.find_layer_from_group(group_id)
+        if layer_idx == -1:
+            raise ValueError, \
+                'can not find the layer for group %s' % (group_id)
+        return layer_idx
 
     ## \brief Get duplicate group of a layer.
     #