diff options
author | Tom Rondeau | 2011-05-08 19:58:43 +0100 |
---|---|---|
committer | Tom Rondeau | 2011-05-08 19:58:43 +0100 |
commit | a72bde633dda63c4471111894ca6b92a87318d5f (patch) | |
tree | c60e447e922b1a7076dd839ed8a94fcc9b665919 /grc/python/Port.py | |
parent | bdd0bd405c2ea645395917c1abb91c964210c4d9 (diff) | |
parent | 207a2ae73bd5d6cab201bb57ed8db64fd54cfd90 (diff) | |
download | gnuradio-a72bde633dda63c4471111894ca6b92a87318d5f.tar.gz gnuradio-a72bde633dda63c4471111894ca6b92a87318d5f.tar.bz2 gnuradio-a72bde633dda63c4471111894ca6b92a87318d5f.zip |
Merge branch 'master' into 8psk
Diffstat (limited to 'grc/python/Port.py')
-rw-r--r-- | grc/python/Port.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/grc/python/Port.py b/grc/python/Port.py index 6e5a5c59f..3846b0f4e 100644 --- a/grc/python/Port.py +++ b/grc/python/Port.py @@ -1,5 +1,5 @@ """ -Copyright 2008, 2009 Free Software Foundation, Inc. +Copyright 2008-2011 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -83,16 +83,16 @@ class Port(_Port, _GUIPort): def validate(self): _Port.validate(self) - try: assert self.get_enabled_connections() or self.get_optional() - except AssertionError: self.add_error_message('Port is not connected.') - try: assert self.is_source() or len(self.get_enabled_connections()) <= 1 - except AssertionError: self.add_error_message('Port has too many connections.') + if not self.get_enabled_connections() and not self.get_optional(): + self.add_error_message('Port is not connected.') + if not self.is_source() and len(self.get_enabled_connections()) > 1: + self.add_error_message('Port has too many connections.') #message port logic if self.get_type() == 'msg': - try: assert not self.get_nports() - except AssertionError: self.add_error_message('A port of type "msg" cannot have "nports" set.') - try: assert self.get_vlen() == 1 - except AssertionError: self.add_error_message('A port of type "msg" must have a "vlen" of 1.') + if self.get_nports(): + self.add_error_message('A port of type "msg" cannot have "nports" set.') + if self.get_vlen() != 1: + self.add_error_message('A port of type "msg" must have a "vlen" of 1.') def rewrite(self): """ @@ -134,8 +134,7 @@ class Port(_Port, _GUIPort): if not nports: return '' try: nports = int(self.get_parent().get_parent().evaluate(nports)) - assert 0 < nports - return nports + if 0 < nports: return nports except: return 1 def get_optional(self): return bool(self._optional) |