Mercurial > MadButterfly
comparison pyink/domview.py @ 1428:43369f3314d8
Fix the issue of loading components from SVG.
- Users can not switch to components in the document that was loaded
from previously saved SVG file.
- Scribboo can not find components with names listed in the component
list.
- It is because that Scribboo is fault to use node name of
ns0:component instead of 'name' attribute as component name.
- It is fixed by using 'name' attribute of ns0:component node.
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sun, 10 Apr 2011 15:28:33 +0800 |
parents | 5b69baa49a8b |
children | b867960fca02 |
comparison
equal
deleted
inserted
replaced
1427:5b69baa49a8b | 1428:43369f3314d8 |
---|---|
276 | 276 |
277 def _parse_components(self): | 277 def _parse_components(self): |
278 comp_names = self._comp_names | 278 comp_names = self._comp_names |
279 components_node = self._components_node | 279 components_node = self._components_node |
280 for child in components_node.childList(): | 280 for child in components_node.childList(): |
281 child_name = child.name() | 281 child_node_name = child.name() |
282 if child_name != 'ns0:component': | 282 if child_node_name != 'ns0:component': |
283 continue | 283 continue |
284 | |
285 child_name = child.getAttribute('name') | |
284 if child_name in comp_names: | 286 if child_name in comp_names: |
285 raise ValueError, 'duplicate component name %s' % (child_name) | 287 raise ValueError, 'duplicate component name %s' % (child_name) |
286 | 288 |
287 comp = Component(self, child) | 289 comp = Component(self, child) |
288 comp.parse_timelines() | 290 comp.parse_timelines() |
289 | 291 |
290 self._components.append(comp) | 292 self._components.append(comp) |
293 | |
291 comp_names.add(child_name) | 294 comp_names.add(child_name) |
292 pass | 295 pass |
293 pass | 296 pass |
294 | 297 |
295 ## \brief To initialize subtree of metadata. | 298 ## \brief To initialize subtree of metadata. |