Mercurial > MadButterfly
comparison pyink/MBScene.py @ 975:ed7e8e309d55
Remove generate function
author | wycc |
---|---|
date | Sat, 20 Nov 2010 11:47:40 +0800 |
parents | 84f502fb3e40 |
children | ab09c536a137 |
comparison
equal
deleted
inserted
replaced
974:8560ab7c1a63 | 975:ed7e8e309d55 |
---|---|
250 txt.setAttribute("width","100",True) | 250 txt.setAttribute("width","100",True) |
251 txt.setAttribute("height","100",True) | 251 txt.setAttribute("height","100",True) |
252 txt.setAttribute("style","fill:#ff00",True) | 252 txt.setAttribute("style","fill:#ff00",True) |
253 ns.appendChild(txt) | 253 ns.appendChild(txt) |
254 gid = self.newID() | 254 gid = self.newID() |
255 self.ID[gid]=1 | |
255 ns.setAttribute("id",gid,True) | 256 ns.setAttribute("id",gid,True) |
256 self.last_line.node.repr.appendChild(ns) | 257 self.last_line.node.repr.appendChild(ns) |
257 self.last_line.add_keyframe(x,ns) | 258 self.last_line.add_keyframe(x,ns) |
258 self.update() | 259 self.update() |
259 | 260 |
381 i = i + 2 | 382 i = i + 2 |
382 pass | 383 pass |
383 pass | 384 pass |
384 pass | 385 pass |
385 | 386 |
386 def generate(self): | |
387 newdoc = deepcopy(self.document) | |
388 root = newdoc.getroot() | |
389 has_scene = False | |
390 for n in root: | |
391 if n.tag == '{http://www.w3.org/2000/svg}metadata': | |
392 for nn in n: | |
393 if nn.tag == _scenes: | |
394 nn.clear() | |
395 nn.set("current", "%d" % self.current) | |
396 scenes = [] | |
397 for l in self.layers: | |
398 for s in l.scenes: | |
399 id = s.node.get("id") | |
400 scene = etree.Element(_scene) | |
401 scene.set("ref", id) | |
402 if s.start == s.end: | |
403 scene.set("start", "%d" % s.start) | |
404 else: | |
405 scene.set("start", "%d" % s.start) | |
406 scene.set("end", "%d" % s.end) | |
407 pass | |
408 | |
409 scenes.append(scene) | |
410 pass | |
411 pass | |
412 for s in scenes: | |
413 nn.append(s) | |
414 pass | |
415 has_scene = True | |
416 pass | |
417 pass | |
418 if has_scene == False: | |
419 scenes = etree.Element(_scenes) | |
420 scenes.set("current","%d" % self.current) | |
421 for l in self.layers: | |
422 for s in l.scenes: | |
423 scene = etree.Element(_scene) | |
424 scene.set("ref", s.node.get("id")) | |
425 if s.start == s.end: | |
426 scene.set("start", "%d" % s.start) | |
427 else: | |
428 scene.set("start", "%d" % s.start) | |
429 scene.set("end", "%d" % s.end) | |
430 pass | |
431 scenes.append(scene) | |
432 pass | |
433 pass | |
434 n.append(scenes) | |
435 pass | |
436 pass | |
437 if n.tag == '{http://www.w3.org/2000/svg}g': | |
438 root.remove(n) | |
439 pass | |
440 pass | |
441 | |
442 for l in self.layers: | |
443 # Duplicate all attribute of the layer | |
444 lnode = etree.Element("{http://www.w3.org/2000/svg}g") | |
445 for a,v in l.node.attrib.items(): | |
446 lnode.set(a,v) | |
447 pass | |
448 for n in l.nodes: | |
449 lnode.append(n) | |
450 pass | |
451 root.append(lnode) | |
452 for s in l.scenes: | |
453 snode = etree.Element("{http://www.w3.org/2000/svg}g") | |
454 for a,v in s.node.attrib.items(): | |
455 snode.set(a,v) | |
456 pass | |
457 for n in s.node: | |
458 snode.append(deepcopy(n)) | |
459 pass | |
460 lnode.append(snode) | |
461 pass | |
462 pass | |
463 self.document = newdoc | |
464 pass | |
465 | 387 |
466 def newCell(self,file): | 388 def newCell(self,file): |
467 img = gtk.Image() | 389 img = gtk.Image() |
468 img.set_from_file(file) | 390 img.set_from_file(file) |
469 btn = gtk.EventBox() | 391 btn = gtk.EventBox() |