From 28bbeb38f65ebe5b6422e52d31b359ddfac94fc2 Mon Sep 17 00:00:00 2001
From: jblum
Date: Sat, 15 Nov 2008 00:23:27 +0000
Subject: only change id if not unique

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9994 221aa14e-8319-0410-a670-987f0aec2ac5
---
 grc/src/platforms/gui/FlowGraph.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'grc/src/platforms/gui/FlowGraph.py')

diff --git a/grc/src/platforms/gui/FlowGraph.py b/grc/src/platforms/gui/FlowGraph.py
index 5b40154c4..e387ccc9b 100644
--- a/grc/src/platforms/gui/FlowGraph.py
+++ b/grc/src/platforms/gui/FlowGraph.py
@@ -140,7 +140,6 @@ class FlowGraph(Element):
 		for block_n in blocks_n:
 			block_key = block_n['key']
 			if block_key == 'options': continue
-			block_id = self._get_unique_id(block_key)
 			block = self.get_new_block(block_key)
 			selected.add(block)
 			#set params
@@ -151,7 +150,9 @@ class FlowGraph(Element):
 				#setup id parameter
 				if param_key == 'id':
 					old_id2block[param_value] = block
-					param_value = block_id
+					#if the block id is not unique, get a new block id
+					if param_value in [block.get_id() for block in self.get_blocks()]:
+						param_value = self._get_unique_id(param_value)
 				#set value to key
 				block.get_param(param_key).set_value(param_value)
 			#move block to offset coordinate
-- 
cgit