# HG changeset patch # User Thinker K.F. Li # Date 1293514534 -28800 # Node ID a7faab54e8f826cf20a4bb87ac5cc28225825247 # Parent 1a699dc00fa3423fc8e6d6e5e2dd7b5481cdb0ff Fix broken of running animation - Running animation is stop automatically after a certain time. - It is 300ms according MBScene._updateUI(). - It is caused by notification of changing DOM tree. The notification handlers would call MBScene.updateUI() to update framelines and buttons. - MBScene.updateUI() would call MBScene.show() after 300ms, MBScene.show() calls MBScene.parseScene() in turn. - MBScene.parseScene() would remove duplicate group that is using by code of running animation, MBScene.doRunNext(). It make running animation stop. - fixed by setting MBScene.lockui when a running animation is started or stoped. diff -r 1a699dc00fa3 -r a7faab54e8f8 pyink/MBScene.py --- a/pyink/MBScene.py Tue Dec 28 13:35:34 2010 +0800 +++ b/pyink/MBScene.py Tue Dec 28 13:35:34 2010 +0800 @@ -86,7 +86,7 @@ if self.type == 'DOMSubtreeModified': self.func(node) def notifyAttributeChanged(self,node, name, old_value, new_value): - print 'attr',node,name,old_value,new_value + # print 'attr',node,name,old_value,new_value if self.type == 'DOMAttrModified': self.func(node,name) @@ -336,6 +336,8 @@ try: label = scene.getAttribute('inkscape:label') if label == 'dup': + # XXX: This would stop animation. + # This function is called by updateUI() node.removeChild(scene) except: pass @@ -873,16 +875,22 @@ """ if self.btnRun.get_label() == "Run": self.btnRun.set_label("Stop") + self.lockui = True self.last_update = glib.timeout_add(1000/self.framerate,self.doRunNext) else: self.btnRun.set_label("Run") glib.source_remove(self.last_update) + self.lockui = False + pass def doRunNext(self): if self.current >= self.maxframe: self.current = 0 - print self.current,self.maxframe - self.setCurrentScene(self.current+1) + try: + self.setCurrentScene(self.current+1) + except: + traceback.print_exc() + raise self.last_update = glib.timeout_add(1000/self.framerate,self.doRunNext) diff -r 1a699dc00fa3 -r a7faab54e8f8 pyink/frameline.py --- a/pyink/frameline.py Tue Dec 28 13:35:34 2010 +0800 +++ b/pyink/frameline.py Tue Dec 28 13:35:34 2010 +0800 @@ -710,7 +710,8 @@ block = (key.idx, next_key.idx, key.right_tween_type) elif not key.left_tween: block = (key.idx, key.idx, 0) - pass + else: + continue blocks.append(block) pass return blocks