# HG changeset patch # User Thinker K.F. Li # Date 1302438606 -28800 # Node ID bf405cb2d7cb325f6f98d21f5fcf0943d7cf83a4 # Parent b867960fca0278880b760c45d54dbb5f63d17b8b Switch to latest timeline when switching back to a component diff -r b867960fca02 -r bf405cb2d7cb pyink/domview.py --- a/pyink/domview.py Sun Apr 10 18:46:56 2011 +0800 +++ b/pyink/domview.py Sun Apr 10 20:30:06 2011 +0800 @@ -474,9 +474,7 @@ self._layers_parent = \ self._get_layers_group_of_component(comp_name) - first_name = comp.all_timeline_names()[0] - self._cur_timeline = None - self.switch_timeline(first_name) + self.make_sure_timeline() try: comp_grp = self.get_component_group(old_comp.name()) @@ -586,6 +584,22 @@ # Make domview to rescan layers and scenes. self.reset() # from domview + + cur_comp_name = self.get_current_component() + cur_comp_node = self.get_component_group(cur_comp_name) + cur_comp_node.setAttribute("cur_timeline", timeline_name) + pass + + def make_sure_timeline(self): + cur_comp_name = self.get_current_component() + cur_comp_node = self.get_component_group(cur_comp_name) + try: + timeline_name = cur_comp_node.getAttribute("cur_timeline") + except KeyError: + timeline_name = self.all_timeline_names()[0] + pass + self._cur_timeline = None + self.switch_timeline(timeline_name) pass def add_timeline(self, timeline_name):