comparison pyink/domview.py @ 1419:3519f43da037

Check old component before hiding it for a component switching. Ref: ticket #37 in assembla - Scribboo try to hide old component before switching to new one. But, old one was already removed. It cause an error. - This is fixed by checking old component if it is still existed before hiding it.
author Thinker K.F. Li <thinker@codemud.net>
date Thu, 07 Apr 2011 13:45:07 +0800
parents 485cca025a77
children 5b69baa49a8b
comparison
equal deleted inserted replaced
1418:485cca025a77 1419:3519f43da037
472 self._get_layers_group_of_component(comp_name) 472 self._get_layers_group_of_component(comp_name)
473 473
474 first_name = comp.all_timeline_names()[0] 474 first_name = comp.all_timeline_names()[0]
475 self.switch_timeline(first_name) 475 self.switch_timeline(first_name)
476 476
477 self.hide_component(old_comp.name()) 477 try:
478 comp_grp = self.get_component_group(old_comp.name())
479 old_comp_existed = True
480 except ValueError:
481 old_comp_existed = False
482 pass
483
484 if old_comp_existed:
485 self.hide_component(old_comp.name())
486 pass
487
478 self.show_component(comp.name()) 488 self.show_component(comp.name())
479 pass 489 pass
480 490
481 def add_component(self, comp_name): 491 def add_component(self, comp_name):
482 if self.has_component(comp_name): 492 if self.has_component(comp_name):