Mercurial > MadButterfly
diff pyink/MBScene.py @ 1531:5a3597eba722
Switch current layer away before removing a layer.
We must switch current layer to another one before removing a layer
group node. It avoids a crash since inkscape does not know the group
node of the layer is removed, and it would emit a signal on this node
later.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Wed, 28 Sep 2011 21:54:39 +0800 |
parents | af8dd27bf450 |
children | 4a92b639a1cd |
line wrap: on
line diff
--- a/pyink/MBScene.py Tue Sep 27 10:45:12 2011 +0800 +++ b/pyink/MBScene.py Wed Sep 28 21:54:39 2011 +0800 @@ -270,6 +270,16 @@ def doRemoveLayer(self, w): domview = self._domviewui layer_idx, frame_idx = domview.get_current_frame() + if layer_idx == 0: # never remove first layer (default) + return + + # We must switch current layer to another one before removing a layer + # group node. It avoids a crash since inkscape does not know the group + # node of the layer is removed, and it would emit a signal on this node + # later. + self.selectSceneObject(layer_idx - 1, frame_idx) + + self._domviewui.remember_current_frame(layer_idx - 1, frame_idx) domview.rm_layer(layer_idx) pass