comparison pyink/MBScene.py @ 1202:2f3d523a3871

Parse all scenes when start handling a document
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 03 Jan 2011 14:06:18 +0800
parents 582d3410e546
children b90a1e2eb9ec
comparison
equal deleted inserted replaced
1201:582d3410e546 1202:2f3d523a3871
301 self._doc = doc 301 self._doc = doc
302 self._root = root 302 self._root = root
303 303
304 self._start_monitor() # start MBScene_dom_monitor 304 self._start_monitor() # start MBScene_dom_monitor
305 self._init_metadata() 305 self._init_metadata()
306 self._parse_all_scenes()
306 pass 307 pass
307 308
308 def dumpattr(self, n): 309 def dumpattr(self, n):
309 s = "" 310 s = ""
310 for a,v in n.attrib.items(): 311 for a,v in n.attrib.items():
368 if cur >= start and cur <= end: 369 if cur >= start and cur <= end:
369 self.currentscene = link 370 self.currentscene = link
370 pass 371 pass
371 pass 372 pass
372 pass 373 pass
373 374
375 ## \brief Parse all scenes node in svg:metadata subtree.
376 #
377 def _parse_all_scenes(self):
378 root = self._root
379 for child in root.childList():
380 if child.name() != 'svg:metadata':
381 continue
382
383 metadata_node = child
384 for metachild in metadata_node.childList():
385 if metachild.name() == 'ns0:scenes':
386 self._parse_one_scenes(metachild)
387 pass
388 pass
389 pass
390 pass
391
392 ## \brief Create a scenes node if not existed.
393 #
374 def _init_metadata(self): 394 def _init_metadata(self):
375 for node in self._root.childList(): 395 for node in self._root.childList():
376 if node.name() == 'svg:metadata': 396 if node.name() == 'svg:metadata':
377 break 397 break
378 pass 398 pass