changeset 1329:2b051e474b0f

Avoid component name confliction
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 31 Jan 2011 13:24:02 +0800
parents 407f321f0d7c
children c2a693a27eb9
files pyink/MBScene.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/pyink/MBScene.py	Mon Jan 31 12:47:49 2011 +0800
+++ b/pyink/MBScene.py	Mon Jan 31 13:24:02 2011 +0800
@@ -406,6 +406,11 @@
 	node_parent_group = node.parent()
 	
 	comp_name = 'Component ' + node.getAttribute('id')
+	i = 0
+	while comp_name in self._domviewui.all_comp_names():
+	    comp_name = 'Component %s - %d' % (comp_name, i)
+	    i = i + 1
+	    pass
 	self._domviewui.add_component_from_group(comp_name, node)
 	
 	self._domviewui.link_to_component(comp_name, node_parent_group)