changeset 1228:027187a21117

Add undo support. This is not working yet. We need to modify the MBScene_dom to handle the undo events correctly.
author wycc
date Sat, 08 Jan 2011 15:46:09 +0800
parents 983442b2698c
children cc55f3de9c0b
files pyink/MBScene.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/MBScene.py	Fri Jan 07 15:58:45 2011 +0800
+++ b/pyink/MBScene.py	Sat Jan 08 15:46:09 2011 +0800
@@ -116,6 +116,7 @@
     def _on_insert_node(self, node, child):
 	try:
 	    child_id = child.getAttribute('id')
+	    print "On insert node %s" % child_id
 	except:
 	    pass
 	else:
@@ -799,6 +800,7 @@
 	    frameline.duplicateGroup.setAttribute('style', 'display: none')
 	except AttributeError:
 	    pass
+	self.done("remove key")
 	pass
     
     def extendScene(self):
@@ -817,6 +819,7 @@
 	self.chg_scene_node(scene_node, end=frame_idx)
 	frameline.add_keyframe(frame_idx)
 	frameline.tween(start, scene_type)
+	self.done("extend scene")
 	pass
     
     def setCurrentScene(self, idx):
@@ -1136,6 +1139,7 @@
     def changeObjectLabel(self,w):
 	o = self.desktop.selection.list()[0]
 	o.setAttribute("inkscape:label", self.nameEditor.get_text())
+	self.done("modify name")
 	pass
 
     def addNameEditor(self,hbox):
@@ -1181,17 +1185,21 @@
 	self.selectSceneObject(self.last_line, self.last_frame)
 	self._lockui=False
 	# self.grid.show_all()
+	self.done("new key")
 	return
     
     def doDuplicateKeyScene(self,w):
 	self._lockui = True
         self.duplicateKeyScene()
 	self._lockui = False
+	self.done("dup key")
+	return
 
     def doRemoveScene(self,w):
 	self._lockui = True
 	self.removeKeyScene(self.last_line, self.last_frame)
 	self._lockui = False
+	self.done("remove key")
 	return
 
     
@@ -1199,6 +1207,7 @@
 	self._lockui = True
 	self.extendScene()
 	self._lockui = False
+	self.done("extend key")
 	pass
 
     def doRun(self,arg):
@@ -1365,6 +1374,7 @@
 	
 	scene_node = frameline.get_frame_data(start)
 	self.chg_scene_node(scene_node, tween_type=type_name)
+	self.done("None","change tween type")
 	pass
 
     def addTweenTypeSelector(self, hbox):
@@ -1392,6 +1402,11 @@
 	gtk.main_quit()
 	pass
 
+    def done(self, desc):
+	spdoc = self.desktop.doc()
+	spdoc.done("None",desc)
+	pass
+
     def show(self):
 	self.OK = True
 	if not self.root: