comparison pyink/domview.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 e2ad9eb7f7a4
comparison
equal deleted inserted replaced
1315:fcff6978f9bf 1316:9ab8d50dcf7e
167 167
168 self._components.append(comp) 168 self._components.append(comp)
169 self._comp_names.add('main') 169 self._comp_names.add('main')
170 170
171 self._main_comp = comp 171 self._main_comp = comp
172 self._cur_comp = comp
173 pass 172 pass
174 173
175 def _parse_components(self): 174 def _parse_components(self):
176 comp_names = self._comp_names 175 comp_names = self._comp_names
177 components_node = self._components_node 176 components_node = self._components_node
230 229
231 def _start_component_manager(self): 230 def _start_component_manager(self):
232 self._component_manager_init_metadata() 231 self._component_manager_init_metadata()
233 self._set_main_component() 232 self._set_main_component()
234 self._parse_components() 233 self._parse_components()
234
235 self._cur_comp = self._main_comp
236 tl = self._main_comp.get_timeline('default')
237 self._cur_timeline = tl
238 self._scenes_node = tl.scenes_node
235 pass 239 pass
236 240
237 def _create_component_group(self): 241 def _create_component_group(self):
238 doc = self._doc 242 doc = self._doc
239 group = doc.createElement('svg:g') 243 group = doc.createElement('svg:g')
350 354
351 comp_node = comp.node 355 comp_node = comp.node
352 gid = comp_node.getAttribute('ref') 356 gid = comp_node.getAttribute('ref')
353 comp_group = self.get_node(gid) 357 comp_group = self.get_node(gid)
354 return comp_group 358 return comp_group
359
360 def get_current_component(self):
361 return self._cur_comp.name()
355 362
356 def switch_timeline(self, timeline_name): 363 def switch_timeline(self, timeline_name):
357 tl = self._cur_comp.get_timeline(timeline_name) 364 tl = self._cur_comp.get_timeline(timeline_name)
358 self._cur_timeline = tl 365 self._cur_timeline = tl
359 self._scenes_node = tl.scenes_node # of class domview 366 self._scenes_node = tl.scenes_node # of class domview
375 return r 382 return r
376 383
377 def has_timeline(self, name): 384 def has_timeline(self, name):
378 r = self._cur_comp.has_timeline(name) 385 r = self._cur_comp.has_timeline(name)
379 return r 386 return r
387
388 def get_current_timeline(self):
389 return self._cur_timeline.name()
380 pass 390 pass
381 391
382 392
383 ## \brief Monitor changes of DOM-tree. 393 ## \brief Monitor changes of DOM-tree.
384 # 394 #