comparison pyink/domview.py @ 1430:bf405cb2d7cb

Switch to latest timeline when switching back to a component
author Thinker K.F. Li <thinker@codemud.net>
date Sun, 10 Apr 2011 20:30:06 +0800
parents b867960fca02
children 60f2c9a24cdb
comparison
equal deleted inserted replaced
1429:b867960fca02 1430:bf405cb2d7cb
472 comp_name = self._cur_comp.name() 472 comp_name = self._cur_comp.name()
473 # for domview 473 # for domview
474 self._layers_parent = \ 474 self._layers_parent = \
475 self._get_layers_group_of_component(comp_name) 475 self._get_layers_group_of_component(comp_name)
476 476
477 first_name = comp.all_timeline_names()[0] 477 self.make_sure_timeline()
478 self._cur_timeline = None
479 self.switch_timeline(first_name)
480 478
481 try: 479 try:
482 comp_grp = self.get_component_group(old_comp.name()) 480 comp_grp = self.get_component_group(old_comp.name())
483 old_comp_existed = True 481 old_comp_existed = True
484 except ValueError: 482 except ValueError:
584 self._cur_timeline = tl 582 self._cur_timeline = tl
585 self._scenes_node = tl.scenes_node # of class domview 583 self._scenes_node = tl.scenes_node # of class domview
586 584
587 # Make domview to rescan layers and scenes. 585 # Make domview to rescan layers and scenes.
588 self.reset() # from domview 586 self.reset() # from domview
587
588 cur_comp_name = self.get_current_component()
589 cur_comp_node = self.get_component_group(cur_comp_name)
590 cur_comp_node.setAttribute("cur_timeline", timeline_name)
591 pass
592
593 def make_sure_timeline(self):
594 cur_comp_name = self.get_current_component()
595 cur_comp_node = self.get_component_group(cur_comp_name)
596 try:
597 timeline_name = cur_comp_node.getAttribute("cur_timeline")
598 except KeyError:
599 timeline_name = self.all_timeline_names()[0]
600 pass
601 self._cur_timeline = None
602 self.switch_timeline(timeline_name)
589 pass 603 pass
590 604
591 def add_timeline(self, timeline_name): 605 def add_timeline(self, timeline_name):
592 self._cur_comp.add_timeline(timeline_name) 606 self._cur_comp.add_timeline(timeline_name)
593 pass 607 pass