]> git.gag.com Git - debian/gnuradio/commitdiff
Properly handle duplicated IDs.
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 18 Mar 2009 05:56:59 +0000 (05:56 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Wed, 18 Mar 2009 05:56:59 +0000 (05:56 +0000)
Duplicates OK in disabled blocks.
Confine validation errors to blocks involved.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10633 221aa14e-8319-0410-a670-987f0aec2ac5

grc/src/platforms/python/Param.py

index e92494bcd6690fd81b71a27deb9b8c8b925f08a0..efebe92e5d209ff4463896bd328706eea90da134 100644 (file)
@@ -215,7 +215,7 @@ class Param(_Param):
                #########################
                # Enum Type
                #########################
-               if self.is_enum(): return self.get_value()
+               if self.is_enum(): return v
                #########################
                # Numeric Types
                #########################
@@ -305,7 +305,7 @@ class Param(_Param):
                                raise Exception
                        params = self.get_all_params('id')
                        keys = [param.get_value() for param in params]
-                       try: assert(len(keys) == len(set(keys)))
+                       try: assert keys.count(v) <= 1 #id should only appear once, or zero times if block is disabled
                        except:
                                self._add_error_message('ID "%s" is not unique.'%v)
                                raise Exception
@@ -392,4 +392,4 @@ class Param(_Param):
                @param type the specified type
                @return a list of params
                """
-               return sum([filter(lambda p: p.get_type() == type, block.get_params()) for block in self.get_parent().get_parent().get_blocks()], [])
+               return sum([filter(lambda p: p.get_type() == type, block.get_params()) for block in self.get_parent().get_parent().get_enabled_blocks()], [])