]> git.gag.com Git - debian/gnuradio/commitdiff
moved unique id fcn to base platform, fixed paste bug
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 17 Sep 2008 14:28:14 +0000 (14:28 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 17 Sep 2008 14:28:14 +0000 (14:28 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9599 221aa14e-8319-0410-a670-987f0aec2ac5

grc/src/platforms/base/FlowGraph.py
grc/src/platforms/gui/FlowGraph.py

index bb20c61d0733c09664c06b792d566fb0f4edb117..071e5939652434ba445341132af9dc272f50b081 100644 (file)
@@ -39,6 +39,19 @@ class FlowGraph(Element):
                #inital blank import
                self.import_data({'flow_graph': {}})
 
+       def _get_unique_id(self, base_id=''):
+               """
+               Get a unique id starting with the base id.
+               @param base_id the id starts with this and appends a count
+               @return a unique id
+               """
+               index = 0
+               while True:
+                       id = '%s_%d'%(base_id, index)
+                       index = index + 1
+                       #make sure that the id is not used by another block
+                       if not filter(lambda b: b.get_id() == id, self.get_blocks()): return id
+
        def __str__(self): return 'FlowGraph - "%s"'%self.get_option('name')
 
        def get_option(self, key):
index 2de4482aba966e0140c38d984bef490f88ef6f50..c547a4e78d7693d05219423fb34859b9f76ae457 100644 (file)
@@ -27,6 +27,7 @@ from ... gui.Actions import \
        BLOCK_PARAM_MODIFY, BLOCK_MOVE
 import Colors
 import Utils
+from ... import utils
 from ... gui.ParamsDialog import ParamsDialog
 from Element import Element
 from .. base import FlowGraph as _FlowGraph
@@ -62,19 +63,6 @@ class FlowGraph(Element):
                self._old_selected_port = None
                self._new_selected_port = None
 
-       def _get_unique_id(self, base_id=''):
-               """
-               Get a unique id starting with the base id.
-               @param base_id the id starts with this and appends a count
-               @return a unique id
-               """
-               index = -1
-               while True:
-                       id = (index < 0) and base_id or '%s%d'%(base_id, index)
-                       index = index + 1
-                       #make sure that the id is not used by another block
-                       if not filter(lambda b: b.get_id() == id, self.get_blocks()): return id
-
 ###########################################################################
 # Access Drawing Area
 ###########################################################################
@@ -155,7 +143,7 @@ class FlowGraph(Element):
                        block = self.get_new_block(block_key)
                        selected.add(block)
                        #set params
-                       params_n = Utils.listify(block_n, 'param')
+                       params_n = utils.listify(block_n, 'param')
                        for param_n in params_n:
                                param_key = param_n['key']
                                param_value = param_n['value']