changeset 1261:6177f5d0ef01

Remove the layer when a layer group being removed.
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 11 Jan 2011 17:59:17 +0800
parents bbd6bc0d079a
children 2f861eea1214
files pyink/consistency.py pyink/domview_ui.py
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/consistency.py	Tue Jan 11 17:57:11 2011 +0800
+++ b/pyink/consistency.py	Tue Jan 11 17:59:17 2011 +0800
@@ -83,6 +83,19 @@
             pass
         else:               # We have found the key frame.
             self._domview.unmark_key(layer_idx, start)
+            return
+
+        #
+        # Remove layers
+        #
+        if child_name == 'svg:g':
+            try:
+                layer_idx = self._domview.find_layer_from_group(group_id)
+            except ValueError:
+                pass
+            else:               # It is a layer group
+                self._domview.rm_layer(layer_idx)
+                pass
             pass
         pass
 
--- a/pyink/domview_ui.py	Tue Jan 11 17:57:11 2011 +0800
+++ b/pyink/domview_ui.py	Tue Jan 11 17:59:17 2011 +0800
@@ -596,7 +596,7 @@
     ## \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)
+        layer_idx = self._dom.find_layer_of_group(group_id)
         if layer_idx == -1:
             raise ValueError, \
                 'can not find the layer for group %s' % (group_id)