comparison pyink/MBScene.py @ 1184:05d33f0fbc76

Add comment for some TODO item
author Thinker K.F. Li <thinker@codemud.net>
date Fri, 31 Dec 2010 13:09:47 +0800
parents e8446e138427
children 9d784a987d87
comparison
equal deleted inserted replaced
1183:e8446e138427 1184:05d33f0fbc76
220 except: 220 except:
221 traceback.print_exc() 221 traceback.print_exc()
222 scene_type = 'normal' 222 scene_type = 'normal'
223 pass 223 pass
224 link = scene.getAttribute("ref") 224 link = scene.getAttribute("ref")
225 self.scenemap[link] = [int(start), int(end), scene_type] 225 self.scenemap[link] = (int(start), int(end), scene_type)
226 if cur >= start and cur <= end: 226 if cur >= start and cur <= end:
227 self.currentscene = link 227 self.currentscene = link
228 pass 228 pass
229 pass 229 pass
230 pass 230 pass
391 """ 391 """
392 self.layers = [] 392 self.layers = []
393 self.scenemap = None 393 self.scenemap = None
394 doc = self.root 394 doc = self.root
395 395
396 # TODO: Remove following code sicne this function is for parsing.
397 # Why do this here?
396 addEventListener(doc,'DOMNodeInserted',self.updateUI,None) 398 addEventListener(doc,'DOMNodeInserted',self.updateUI,None)
397 addEventListener(doc,'DOMNodeRemoved',self.updateUI,None) 399 addEventListener(doc,'DOMNodeRemoved',self.updateUI,None)
400
398 doc.childList() 401 doc.childList()
399 try: 402 try:
400 self.width = float(doc.getAttribute("width")) 403 self.width = float(doc.getAttribute("width"))
401 self.height= float(doc.getAttribute("height")) 404 self.height= float(doc.getAttribute("height"))
402 except: 405 except:
409 if node.name() == 'svg:metadata': 412 if node.name() == 'svg:metadata':
410 self.parseMetadata(node) 413 self.parseMetadata(node)
411 pass 414 pass
412 elif node.name() == 'svg:g': 415 elif node.name() == 'svg:g':
413 oldscene = None 416 oldscene = None
414 #obs = LayerAttributeWatcher(self)
415 #addEventListener(doc,'DOMAttrModified',self.updateUI,None)
416 #node.addObserver(obs)
417 lyobj = Layer(node) 417 lyobj = Layer(node)
418 self.layers.append(lyobj) 418 self.layers.append(lyobj)
419 lyobj.current_scene = [] 419 lyobj.current_scene = []
420 for scene in node.childList(): 420 for scene in node.childList():
421 print scene.getCenter() 421 print scene.getCenter()
422 if scene.name() == 'svg:g': 422 if scene.name() == 'svg:g':
423 try: 423 try:
424 label = scene.getAttribute('inkscape:label') 424 label = scene.getAttribute('inkscape:label')
425 if label == 'dup': 425 if label == 'dup':
426 # XXX: This would stop animation. 426 # TODO: remove this since this functio is for
427 # This function is called by updateUI() 427 # parsing. Why do this here?
428 node.removeChild(scene) 428 node.removeChild(scene)
429 except: 429 except:
430 pass 430 pass
431 431
432 try: 432 try:
433 scmap = self.scenemap[scene.getAttribute('id')] 433 scene_id = scene.getAttribute('id')
434 start, stop, tween_type = self.scenemap[scene_id]
434 if scmap == None: 435 if scmap == None:
435 lyobj.current_scene.append(scene) 436 lyobj.current_scene.append(scene)
436 continue 437 continue
437 except: 438 except:
438 lyobj.current_scene.append(scene) 439 lyobj.current_scene.append(scene)
439 continue 440 continue
440 441
441 lyobj.scenes.append(Scene(scene,scmap[0],scmap[1],scmap[2])) 442 lyobj.scenes.append(Scene(scene, start, stop,
443 tween_type))
442 pass 444 pass
443 else: 445 else:
444 lyobj.current_scene.append(scene) 446 lyobj.current_scene.append(scene)
445 pass 447 pass
446 pass 448 pass
447 pass 449 pass
448 pass 450 pass
449 451
450 452 # TODO: Remove following code, too. It is unreasonable.
451 self.collectID() 453 self.collectID()
452 self.dumpID() 454 self.dumpID()
453 pass 455 pass
454 456
455 def collectID(self): 457 def collectID(self):