comparison 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
comparison
equal deleted inserted replaced
1530:9e7e5f79acc6 1531:5a3597eba722
268 pass 268 pass
269 269
270 def doRemoveLayer(self, w): 270 def doRemoveLayer(self, w):
271 domview = self._domviewui 271 domview = self._domviewui
272 layer_idx, frame_idx = domview.get_current_frame() 272 layer_idx, frame_idx = domview.get_current_frame()
273 if layer_idx == 0: # never remove first layer (default)
274 return
275
276 # We must switch current layer to another one before removing a layer
277 # group node. It avoids a crash since inkscape does not know the group
278 # node of the layer is removed, and it would emit a signal on this node
279 # later.
280 self.selectSceneObject(layer_idx - 1, frame_idx)
281
282 self._domviewui.remember_current_frame(layer_idx - 1, frame_idx)
273 domview.rm_layer(layer_idx) 283 domview.rm_layer(layer_idx)
274 pass 284 pass
275 285
276 def doInsertKeyScene(self,w): 286 def doInsertKeyScene(self,w):
277 layer_idx, frame_idx = self._domviewui.get_active_layer_frame() 287 layer_idx, frame_idx = self._domviewui.get_active_layer_frame()