commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9599 - in gnuradio/trunk/grc/src/platforms: base gui


From: jblum
Subject: [Commit-gnuradio] r9599 - in gnuradio/trunk/grc/src/platforms: base gui
Date: Wed, 17 Sep 2008 08:28:15 -0600 (MDT)

Author: jblum
Date: 2008-09-17 08:28:14 -0600 (Wed, 17 Sep 2008)
New Revision: 9599

Modified:
   gnuradio/trunk/grc/src/platforms/base/FlowGraph.py
   gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py
Log:
moved unique id fcn to base platform, fixed paste bug

Modified: gnuradio/trunk/grc/src/platforms/base/FlowGraph.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/base/FlowGraph.py  2008-09-17 04:31:37 UTC 
(rev 9598)
+++ gnuradio/trunk/grc/src/platforms/base/FlowGraph.py  2008-09-17 14:28:14 UTC 
(rev 9599)
@@ -39,6 +39,19 @@
                #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):

Modified: gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py   2008-09-17 04:31:37 UTC 
(rev 9598)
+++ gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py   2008-09-17 14:28:14 UTC 
(rev 9599)
@@ -27,6 +27,7 @@
        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 @@
                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 @@
                        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']





reply via email to

[Prev in Thread] Current Thread [Next in Thread]