Mercurial > MadButterfly
comparison pyink/MBScene.py @ 1174:96a7abce774a
Add functions to insert and remove frame.
author | wycc |
---|---|
date | Fri, 31 Dec 2010 00:49:58 +0800 |
parents | 16ea7b81eda8 |
children | 0c1ceecb8ddb |
comparison
equal
deleted
inserted
replaced
1172:178b126edd2c | 1174:96a7abce774a |
---|---|
80 if self.type == 'DOMNodeRemoved': | 80 if self.type == 'DOMNodeRemoved': |
81 self.func(node) | 81 self.func(node) |
82 def notifyChildOrderChanged(self,node,child,prev): | 82 def notifyChildOrderChanged(self,node,child,prev): |
83 pass | 83 pass |
84 def notifyContentChanged(self,node,old_content,new_content): | 84 def notifyContentChanged(self,node,old_content,new_content): |
85 print 'cont' | |
86 if self.type == 'DOMSubtreeModified': | 85 if self.type == 'DOMSubtreeModified': |
87 self.func(node) | 86 self.func(node) |
88 def notifyAttributeChanged(self,node, name, old_value, new_value): | 87 def notifyAttributeChanged(self,node, name, old_value, new_value): |
89 # print 'attr',node,name,old_value,new_value | 88 # print 'attr',node,name,old_value,new_value |
90 if self.type == 'DOMAttrModified': | 89 if self.type == 'DOMAttrModified': |
448 gid = self.last_line.node.getAttribute('inkscape:label')+self.newID() | 447 gid = self.last_line.node.getAttribute('inkscape:label')+self.newID() |
449 self.ID[gid]=1 | 448 self.ID[gid]=1 |
450 ns.setAttribute("id",gid) | 449 ns.setAttribute("id",gid) |
451 ns.setAttribute("inkscape:groupmode","layer") | 450 ns.setAttribute("inkscape:groupmode","layer") |
452 self.last_line.node.appendChild(ns) | 451 self.last_line.node.appendChild(ns) |
453 print 'Add key ', x | |
454 self.last_line.add_keyframe(x,ns) | 452 self.last_line.add_keyframe(x,ns) |
455 self.update() | 453 self.update() |
456 pass | 454 pass |
457 | 455 |
458 def removeKeyScene(self): | 456 def removeKeyScene(self): |
725 vbox = gtk.VBox() | 723 vbox = gtk.VBox() |
726 vbox.show() | 724 vbox.show() |
727 self.scrollwin.add_with_viewport(vbox) | 725 self.scrollwin.add_with_viewport(vbox) |
728 self.scrollwin_vbox = vbox | 726 self.scrollwin_vbox = vbox |
729 else: | 727 else: |
730 self.scrollwin.remove(self.scrollwin_vbox) | 728 for c in self.scrollwin_vbox.get_children(): |
731 vbox = gtk.VBox() | 729 self.scrollwin_vbox.remove(c) |
732 vbox.show() | 730 vbox = self.scrollwin_vbox |
733 self.scrollwin.add_with_viewport(vbox) | |
734 self.scrollwin_vbox = vbox | |
735 pass | 731 pass |
736 | 732 |
737 nframes = 100 | 733 nframes = 100 |
738 | 734 |
739 ruler = frameruler(nframes) | 735 ruler = frameruler(nframes) |
765 line.nLayer = i | 761 line.nLayer = i |
766 line.node = self.layers[i].node | 762 line.node = self.layers[i].node |
767 line.layer = self.layers[i] | 763 line.layer = self.layers[i] |
768 line.connect('motion-notify-event', self._remove_active_frame) | 764 line.connect('motion-notify-event', self._remove_active_frame) |
769 pass | 765 pass |
766 vbox.show_all() | |
770 pass | 767 pass |
771 | 768 |
772 ## \brief Update conetent of frameliens according layers. | 769 ## \brief Update conetent of frameliens according layers. |
773 # | 770 # |
774 def _update_framelines(self): | 771 def _update_framelines(self): |
928 self.setCurrentScene(self.current+1) | 925 self.setCurrentScene(self.current+1) |
929 except: | 926 except: |
930 traceback.print_exc() | 927 traceback.print_exc() |
931 raise | 928 raise |
932 self.last_update = glib.timeout_add(1000/self.framerate,self.doRunNext) | 929 self.last_update = glib.timeout_add(1000/self.framerate,self.doRunNext) |
933 | 930 |
931 def doInsertScene(self,w): | |
932 self.lockui=True | |
933 self.last_line.insert_frame(self.last_frame) | |
934 self.update() | |
935 self.lockui=False | |
936 | |
937 def doRemoveScene(self,w): | |
938 self.lockui=True | |
939 self.last_line.remove_frame(self.last_frame) | |
940 self.update() | |
941 self.lockui=False | |
934 | 942 |
935 def addButtons(self,hbox): | 943 def addButtons(self,hbox): |
936 #btn = gtk.Button('Edit') | 944 #btn = gtk.Button('Edit') |
937 #btn.connect('clicked', self.doEditScene) | 945 #btn.connect('clicked', self.doEditScene) |
938 #hbox.pack_start(btn,expand=False,fill=False) | 946 #hbox.pack_start(btn,expand=False,fill=False) |
947 | |
939 btn = gtk.Button('Insert Key') | 948 btn = gtk.Button('Insert Key') |
940 btn.connect('clicked',self.doInsertKeyScene) | 949 btn.connect('clicked',self.doInsertKeyScene) |
941 hbox.pack_start(btn,expand=False,fill=False) | 950 hbox.pack_start(btn,expand=False,fill=False) |
951 | |
942 btn=gtk.Button('Remove Key') | 952 btn=gtk.Button('Remove Key') |
943 btn.connect('clicked', self.doRemoveScene) | 953 btn.connect('clicked', self.doRemoveScene) |
944 hbox.pack_start(btn,expand=False,fill=False) | 954 hbox.pack_start(btn,expand=False,fill=False) |
955 | |
945 btn=gtk.Button('Extend scene') | 956 btn=gtk.Button('Extend scene') |
946 btn.connect('clicked', self.doExtendScene) | 957 btn.connect('clicked', self.doExtendScene) |
947 hbox.pack_start(btn,expand=False,fill=False) | 958 hbox.pack_start(btn,expand=False,fill=False) |
959 | |
948 btn=gtk.Button('Duplicate Key') | 960 btn=gtk.Button('Duplicate Key') |
949 btn.connect('clicked', self.doDuplicateKeyScene) | 961 btn.connect('clicked', self.doDuplicateKeyScene) |
950 hbox.pack_start(btn,expand=False,fill=False) | 962 hbox.pack_start(btn,expand=False,fill=False) |
963 | |
964 btn=gtk.Button('Duplicate Key') | |
965 btn.connect('clicked', self.doDuplicateKeyScene) | |
966 hbox.pack_start(btn,expand=False,fill=False) | |
967 | |
968 btn=gtk.Button('Insert') | |
969 btn.connect('clicked', self.doInsertScene) | |
970 hbox.pack_start(btn,expand=False,fill=False) | |
971 | |
972 btn=gtk.Button('Remove') | |
973 btn.connect('clicked', self.doRemoveScene) | |
974 hbox.pack_start(btn,expand=False,fill=False) | |
975 | |
951 btn=gtk.Button('Run') | 976 btn=gtk.Button('Run') |
952 btn.connect('clicked', self.doRun) | 977 btn.connect('clicked', self.doRun) |
953 self.btnRun = btn | 978 self.btnRun = btn |
954 hbox.pack_start(btn,expand=False,fill=False) | 979 hbox.pack_start(btn,expand=False,fill=False) |
980 | |
955 self.addNameEditor(hbox) | 981 self.addNameEditor(hbox) |
956 self.addTweenTypeSelector(hbox) | 982 self.addTweenTypeSelector(hbox) |
957 pass | 983 pass |
958 | 984 |
959 def onTweenTypeChange(self, w): | 985 def onTweenTypeChange(self, w): |