Mercurial > MadButterfly
comparison pyink/MBScene.py @ 1229:cc55f3de9c0b
Revert #027187a21117 before applying patches for refactoring.
- #027187a21117 is just a lot of print messages, it make patches rejected.
- The following patches would change a lot, the messages may mean nothing.
- If someone still need #027187a21117, you can pick it back and apply
it again.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 10 Jan 2011 11:45:04 +0800 |
parents | 027187a21117 |
children | f0864d7177e3 |
comparison
equal
deleted
inserted
replaced
1228:027187a21117 | 1229:cc55f3de9c0b |
---|---|
114 pass | 114 pass |
115 | 115 |
116 def _on_insert_node(self, node, child): | 116 def _on_insert_node(self, node, child): |
117 try: | 117 try: |
118 child_id = child.getAttribute('id') | 118 child_id = child.getAttribute('id') |
119 print "On insert node %s" % child_id | |
120 except: | 119 except: |
121 pass | 120 pass |
122 else: | 121 else: |
123 if child_id not in self._id2node: | 122 if child_id not in self._id2node: |
124 self._id2node[child_id] = child | 123 self._id2node[child_id] = child |
798 | 797 |
799 try: | 798 try: |
800 frameline.duplicateGroup.setAttribute('style', 'display: none') | 799 frameline.duplicateGroup.setAttribute('style', 'display: none') |
801 except AttributeError: | 800 except AttributeError: |
802 pass | 801 pass |
803 self.done("remove key") | |
804 pass | 802 pass |
805 | 803 |
806 def extendScene(self): | 804 def extendScene(self): |
807 frame_idx = self.last_frame | 805 frame_idx = self.last_frame |
808 frameline = self.last_line | 806 frameline = self.last_line |
817 | 815 |
818 scene_node = frameline.get_frame_data(start) | 816 scene_node = frameline.get_frame_data(start) |
819 self.chg_scene_node(scene_node, end=frame_idx) | 817 self.chg_scene_node(scene_node, end=frame_idx) |
820 frameline.add_keyframe(frame_idx) | 818 frameline.add_keyframe(frame_idx) |
821 frameline.tween(start, scene_type) | 819 frameline.tween(start, scene_type) |
822 self.done("extend scene") | |
823 pass | 820 pass |
824 | 821 |
825 def setCurrentScene(self, idx): | 822 def setCurrentScene(self, idx): |
826 """ | 823 """ |
827 Update the scene group according to the curretn scene | 824 Update the scene group according to the curretn scene |
1137 return scene_group | 1134 return scene_group |
1138 | 1135 |
1139 def changeObjectLabel(self,w): | 1136 def changeObjectLabel(self,w): |
1140 o = self.desktop.selection.list()[0] | 1137 o = self.desktop.selection.list()[0] |
1141 o.setAttribute("inkscape:label", self.nameEditor.get_text()) | 1138 o.setAttribute("inkscape:label", self.nameEditor.get_text()) |
1142 self.done("modify name") | |
1143 pass | 1139 pass |
1144 | 1140 |
1145 def addNameEditor(self,hbox): | 1141 def addNameEditor(self,hbox): |
1146 self.nameEditor = gtk.Entry(max=40) | 1142 self.nameEditor = gtk.Entry(max=40) |
1147 hbox.pack_start(self.nameEditor,expand=False,fill=False) | 1143 hbox.pack_start(self.nameEditor,expand=False,fill=False) |
1183 self._lockui=True | 1179 self._lockui=True |
1184 self.insertKeyScene(self.last_line, self.last_frame) | 1180 self.insertKeyScene(self.last_line, self.last_frame) |
1185 self.selectSceneObject(self.last_line, self.last_frame) | 1181 self.selectSceneObject(self.last_line, self.last_frame) |
1186 self._lockui=False | 1182 self._lockui=False |
1187 # self.grid.show_all() | 1183 # self.grid.show_all() |
1188 self.done("new key") | |
1189 return | 1184 return |
1190 | 1185 |
1191 def doDuplicateKeyScene(self,w): | 1186 def doDuplicateKeyScene(self,w): |
1192 self._lockui = True | 1187 self._lockui = True |
1193 self.duplicateKeyScene() | 1188 self.duplicateKeyScene() |
1194 self._lockui = False | 1189 self._lockui = False |
1195 self.done("dup key") | |
1196 return | |
1197 | 1190 |
1198 def doRemoveScene(self,w): | 1191 def doRemoveScene(self,w): |
1199 self._lockui = True | 1192 self._lockui = True |
1200 self.removeKeyScene(self.last_line, self.last_frame) | 1193 self.removeKeyScene(self.last_line, self.last_frame) |
1201 self._lockui = False | 1194 self._lockui = False |
1202 self.done("remove key") | |
1203 return | 1195 return |
1204 | 1196 |
1205 | 1197 |
1206 def doExtendScene(self,w): | 1198 def doExtendScene(self,w): |
1207 self._lockui = True | 1199 self._lockui = True |
1208 self.extendScene() | 1200 self.extendScene() |
1209 self._lockui = False | 1201 self._lockui = False |
1210 self.done("extend key") | |
1211 pass | 1202 pass |
1212 | 1203 |
1213 def doRun(self,arg): | 1204 def doRun(self,arg): |
1214 """ | 1205 """ |
1215 Execute the current animation till the last frame. | 1206 Execute the current animation till the last frame. |
1372 | 1363 |
1373 frameline.tween(start, tween_type) | 1364 frameline.tween(start, tween_type) |
1374 | 1365 |
1375 scene_node = frameline.get_frame_data(start) | 1366 scene_node = frameline.get_frame_data(start) |
1376 self.chg_scene_node(scene_node, tween_type=type_name) | 1367 self.chg_scene_node(scene_node, tween_type=type_name) |
1377 self.done("None","change tween type") | |
1378 pass | 1368 pass |
1379 | 1369 |
1380 def addTweenTypeSelector(self, hbox): | 1370 def addTweenTypeSelector(self, hbox): |
1381 tweenbox = gtk.HBox() | 1371 tweenbox = gtk.HBox() |
1382 label = gtk.Label('Tween Type') | 1372 label = gtk.Label('Tween Type') |
1400 def onOK(self, event): | 1390 def onOK(self, event): |
1401 self.OK = True | 1391 self.OK = True |
1402 gtk.main_quit() | 1392 gtk.main_quit() |
1403 pass | 1393 pass |
1404 | 1394 |
1405 def done(self, desc): | |
1406 spdoc = self.desktop.doc() | |
1407 spdoc.done("None",desc) | |
1408 pass | |
1409 | |
1410 def show(self): | 1395 def show(self): |
1411 self.OK = True | 1396 self.OK = True |
1412 if not self.root: | 1397 if not self.root: |
1413 self.root = self.desktop.doc().root().repr | 1398 self.root = self.desktop.doc().root().repr |
1414 pass | 1399 pass |