# HG changeset patch # User Thinker K.F. Li # Date 1294277844 -28800 # Node ID 03daff2d939c77ca65e21c9864fd94642a2e7055 # Parent 9425733a677ed2375cf61978ccdb9c01adb26d2c Add a space after every comma in an argument list diff -r 9425733a677e -r 03daff2d939c pyink/MBScene.py --- a/pyink/MBScene.py Wed Jan 05 22:58:03 2011 +0800 +++ b/pyink/MBScene.py Thu Jan 06 09:37:24 2011 +0800 @@ -43,14 +43,14 @@ # class Layer: - def __init__(self,node): + def __init__(self, node): self.scenes = [] self.group = node pass pass class ObjectWatcher(pybInkscape.PYNodeObserver): - def __init__(self,obj,type,func,arg): + def __init__(self, obj, type, func, arg): self.obj = obj self.type = type self.func = func @@ -71,10 +71,10 @@ if self.type == 'DOMAttrModified': self.func(node, name, old_value, new_value) -def addEventListener(obj, type, func,arg): - obs = ObjectWatcher(obj,type,func,arg) +def addEventListener(obj, type, func, arg): + obs = ObjectWatcher(obj, type, func, arg) obj.addSubtreeObserver(obs) - + pass def _travel_DOM(node): nodes = [node] @@ -108,8 +108,8 @@ self._collect_all_scenes() doc = self._doc - addEventListener(doc,'DOMNodeInserted', self._on_insert_node, None) - addEventListener(doc,'DOMNodeRemoved', self._on_remove_node, None) + addEventListener(doc, 'DOMNodeInserted', self._on_insert_node, None) + addEventListener(doc, 'DOMNodeRemoved', self._on_remove_node, None) addEventListener(doc, 'DOMAttrModified', self._on_attr_modified, None) pass @@ -1172,7 +1172,7 @@ self.last_update = glib.timeout_add(tmout, self.doRunNext) pass - def remove_frame(self,line,frame): + def remove_frame(self, line, frame): for start, end, tween_type in line.get_frame_blocks(): if frame > end: # Don't change the tween before the select frame @@ -1183,16 +1183,16 @@ elif frame < start: # For all tweens after the frame, shift both key frames by one scene_node = line.get_frame_data(start) - self.chg_scene_node(scene_node, start=start-1,end=end-1) + self.chg_scene_node(scene_node, start=start-1, end=end-1) line.rm_keyframe(start) if start != end: line.rm_keyframe(end) line.add_keyframe(start-1) - line.set_frame_data(start-1,scene_node) + line.set_frame_data(start-1, scene_node) if start != end: line.add_keyframe(end-1) - line.tween(start-1,tween_type) + line.tween(start-1, tween_type) pass else: # For the tween contain the frame, remove the end keyframe @@ -1200,16 +1200,16 @@ # if the tween has one frame only. In this case, keep only # the start key frame and remove the second one. scene_node = line.get_frame_data(start) - self.chg_scene_node(scene_node,end=end-1) + self.chg_scene_node(scene_node, end=end-1) line.rm_keyframe(end) if start != end-1: line.add_keyframe(end-1) - line.tween(start,tween_type) + line.tween(start, tween_type) pass pass pass - def insert_frame(self,line,frame): + def insert_frame(self, line, frame): for start, end, tween_type in line.get_frame_blocks(): print "start=",start print "end=",end @@ -1220,7 +1220,7 @@ # For all tweens after the frame, shift both key frames by one scene_node = line.get_frame_data(start) if scene_node==None: continue - self.chg_scene_node(scene_node,start=start+1,end=end+1) + self.chg_scene_node(scene_node, start=start+1, end=end+1) line.rm_keyframe(start) if start != end: line.rm_keyframe(end) @@ -1236,54 +1236,54 @@ # if the tween has one frame only. In this case, keep only # the start key frame and remove the second one. scene_node = line.get_frame_data(start) - self.chg_scene_node(scene_node,end=end+1) + self.chg_scene_node(scene_node, end=end+1) line.rm_keyframe(end) line.add_keyframe(end+1) - line.tween(start,tween_type) + line.tween(start, tween_type) pass pass pass - def doInsertFrame(self,w): + def doInsertFrame(self, w): self.lockui=True - self.insert_frame(self.last_line,self.last_frame) + self.insert_frame(self.last_line, self.last_frame) self.lockui=False - def doRemoveFrame(self,w): + def doRemoveFrame(self, w): self.lockui=True - self.remove_frame(self.last_line,self.last_frame) + self.remove_frame(self.last_line, self.last_frame) self.lockui=False - def addButtons(self,hbox): + def addButtons(self, hbox): btn = gtk.Button('Insert Key') - btn.connect('clicked',self.doInsertKeyScene) - hbox.pack_start(btn,expand=False,fill=False) + btn.connect('clicked', self.doInsertKeyScene) + hbox.pack_start(btn, expand=False, fill=False) btn=gtk.Button('Remove Key') btn.connect('clicked', self.doRemoveScene) - hbox.pack_start(btn,expand=False,fill=False) + hbox.pack_start(btn, expand=False, fill=False) btn=gtk.Button('Extend scene') btn.connect('clicked', self.doExtendScene) - hbox.pack_start(btn,expand=False,fill=False) + hbox.pack_start(btn, expand=False, fill=False) btn=gtk.Button('Duplicate Key') btn.connect('clicked', self.doDuplicateKeyScene) - hbox.pack_start(btn,expand=False,fill=False) + hbox.pack_start(btn, expand=False, fill=False) btn=gtk.Button('insert') btn.connect('clicked', self.doInsertFrame) - hbox.pack_start(btn,expand=False,fill=False) + hbox.pack_start(btn, expand=False, fill=False) btn=gtk.Button('remove') btn.connect('clicked', self.doRemoveFrame) - hbox.pack_start(btn,expand=False,fill=False) + hbox.pack_start(btn, expand=False, fill=False) btn=gtk.Button('Run') btn.connect('clicked', self.doRun) self.btnRun = btn - hbox.pack_start(btn,expand=False,fill=False) + hbox.pack_start(btn, expand=False, fill=False) self.addNameEditor(hbox) self.addTweenTypeSelector(hbox) @@ -1308,7 +1308,7 @@ self.chg_scene_node(scene_node, tween_type=type_name) pass - def addTweenTypeSelector(self,hbox): + def addTweenTypeSelector(self, hbox): tweenbox = gtk.HBox() label = gtk.Label('Tween Type') tweenbox.pack_start(label) @@ -1318,8 +1318,8 @@ #self.tweenTypeSelector.append_text('relocate') self.tweenTypeSelector.append_text('scale') self.tweenTypeSelector.set_active(0) - tweenbox.pack_start(self.tweenTypeSelector, expand=False,fill=False) - hbox.pack_start(tweenbox,expand=False,fill=False) + tweenbox.pack_start(self.tweenTypeSelector, expand=False, fill=False) + hbox.pack_start(tweenbox, expand=False, fill=False) self.tweenTypeSelector.connect('changed', self.onTweenTypeChange) pass @@ -1328,7 +1328,7 @@ gtk.main_quit() pass - def onOK(self,event): + def onOK(self, event): self.OK = True gtk.main_quit() pass @@ -1347,20 +1347,20 @@ self._show_framelines() if self.top == None: - self.top = gtk.VBox(False,0) + self.top = gtk.VBox(False, 0) toplevel = self.desktop.getToplevel() - toplevel.child.child.pack_end(self.top,expand=False) + toplevel.child.child.pack_end(self.top, expand=False) else: self.top.remove(self.startWindow) pass - vbox = gtk.VBox(False,0) + vbox = gtk.VBox(False, 0) self.startWindow = vbox - self.top.pack_start(vbox,expand=False) - vbox.pack_start(self._frameline_box,expand=False) - hbox=gtk.HBox(False,0) + self.top.pack_start(vbox, expand=False) + vbox.pack_start(self._frameline_box, expand=False) + hbox=gtk.HBox(False, 0) self.addButtons(hbox) - vbox.pack_start(hbox,expand=False) + vbox.pack_start(hbox, expand=False) doc = self.document addEventListener(doc,'DOMNodeInserted', self.updateUI, None)