changeset 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
files pyink/domview.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/domview.py	Sun Apr 10 12:07:26 2011 +0800
+++ b/pyink/domview.py	Sun Apr 10 15:28:33 2011 +0800
@@ -278,9 +278,11 @@
         comp_names = self._comp_names
         components_node = self._components_node
         for child in components_node.childList():
-            child_name = child.name()
-            if child_name != 'ns0:component':
+            child_node_name = child.name()
+            if child_node_name != 'ns0:component':
                 continue
+            
+            child_name = child.getAttribute('name')
             if child_name in comp_names:
                 raise ValueError, 'duplicate component name %s' % (child_name)
 
@@ -288,6 +290,7 @@
             comp.parse_timelines()
             
             self._components.append(comp)
+            
             comp_names.add(child_name)
             pass
         pass