Mercurial > MadButterfly
diff pyink/domview_ui.py @ 1316:9ab8d50dcf7e
Refactory code of refreshing UI
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sat, 22 Jan 2011 19:28:36 +0800 |
parents | fcff6978f9bf |
children | 6090be010927 |
line wrap: on
line diff
--- a/pyink/domview_ui.py Sat Jan 22 14:23:42 2011 +0800 +++ b/pyink/domview_ui.py Sat Jan 22 19:28:36 2011 +0800 @@ -388,6 +388,10 @@ self._comp_dock = comp_dock(self) pass + + def _ui_comp_refresh(self): + self._comp_dock.refresh() + pass ## \brief Setup desktop that the document will be serviced. # @@ -410,9 +414,8 @@ def switch_component(self, name): self._dom.switch_component(name) - self.reset() # FIXME: it would parse layers again - # while switch_compoent already parses - # it. + self._framelines_refresh() # from domview_ui + self._comp_dock.refresh_timelines() pass def all_comp_names(self): @@ -423,6 +426,9 @@ r = self._dom.has_component(name) return r + def get_current_component(self): + return self._dom.get_current_component() + def add_timeline(self, name): self._dom.add_timeline(name) self._comp_dock.dom_add_timeline(name) @@ -434,7 +440,8 @@ pass def switch_timeline(self, name): - self._dom.siwtch_timeline(name) + self._dom.switch_timeline(name) + self._framelines_refresh() # from domview_ui pass def all_timeline_names(self): @@ -444,6 +451,9 @@ def has_timeline(self, name): r = self._dom.has_timeline(name) return r + + def get_current_timeline(self): + return self._dom.get_current_timeline() pass @@ -506,19 +516,26 @@ self._fl_stack.init_framelines() self._add_frameline_for_every_layer() self._fl_stack.show_framelines() - self._comp_dock.refresh() # from domview_ui_comp + self._ui_comp_refresh() # from domview_ui_comp self._doc = doc self._root = root pass + ## \brief Update framelines according domview. + # + def _framelines_refresh(self): + self._fl_stack.remove_all_framelines() + self._add_frameline_for_every_layer() + self._fl_stack.show_framelines() + pass + ## \brief Parse the document from the scratch and update UI. # def reset(self): - self._fl_stack.remove_all_framelines() self._dom.reset() - self._add_frameline_for_every_layer() - self._fl_stack.show_framelines() + self._framelines_refresh() + self._ui_comp_refresh() # from domview_ui_comp pass ## \brief Mark given frame as a key frame.