# HG changeset patch # User Thinker K.F. Li # Date 1293628587 -28800 # Node ID d73ef03c96de5a7c0d4095c0d4b0f50f4db7e55d # Parent 9f2b5a1a0d84829c7977ea3a1455f08321d444d2 Refactory code of MBScene.updateUI() from MBScene.show() - It is too busy to reborn full GUI components of pyink everytime the content being updated. - It is fixed by moveing code about updating of frameline to MBScene._updateUI() and avoid calling MBScene.show() to reduce time for updating frameline. diff -r 9f2b5a1a0d84 -r d73ef03c96de pyink/MBScene.py --- a/pyink/MBScene.py Wed Dec 29 14:58:06 2010 +0800 +++ b/pyink/MBScene.py Wed Dec 29 21:16:27 2010 +0800 @@ -714,16 +714,25 @@ pass def _create_framelines(self): - self.scrollwin = gtk.ScrolledWindow() - self.scrollwin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) - self.scrollwin.set_size_request(-1,150) + if not hasattr(self, 'scrollwin'): + self.scrollwin = gtk.ScrolledWindow() + self.scrollwin.set_policy(gtk.POLICY_AUTOMATIC, + gtk.POLICY_AUTOMATIC) + self.scrollwin.set_size_request(-1,150) + vbox = gtk.VBox() + vbox.show() + self.scrollwin.add_with_viewport(vbox) + self.scrollwin_vbox = vbox + else: + self.scrollwin.remove(self.scrollwin_vbox) + vbox = gtk.VBox() + vbox.show() + self.scrollwin.add_with_viewport(vbox) + self.scrollwin_vbox = vbox + pass nframes = 100 - vbox = gtk.VBox() - vbox.show() - self.scrollwin.add_with_viewport(vbox) - ruler = frameruler(nframes) ruler.set_size_request(nframes * 10, 20) ruler.show() @@ -807,7 +816,7 @@ node = self.duplicateSceneGroup(last_key.ref.getAttribute("id")) key.ref = node self.update() - self.show() + self.updateUI() self.doEditScene(None) return last_key = key @@ -1009,15 +1018,17 @@ def updateUI(self,node=None,arg=None): if self.lockui: return - self.lockui = True - self._updateUI() - self.lockui = False + + if self.last_update!= None: + glib.source_remove(self.last_update) + self.last_update = glib.timeout_add(300,self._updateUI) + pass def _updateUI(self,node=None,arg=None): - if self.last_update!= None: - glib.source_remove(self.last_update) - self.last_update = glib.timeout_add(300,self.show) + self.parseScene() + self._create_framelines() + self._update_framelines() pass def show(self): @@ -1028,9 +1039,7 @@ self.document = self.desktop.doc().rdoc self.tween = TweenObject(self.document, self.root) - self.parseScene() - self._create_framelines() - self._update_framelines() + self._updateUI() if self.top == None: self.top = gtk.VBox(False,0) self.desktop.getToplevel().child.child.pack_end(self.top,expand=False)