summaryrefslogtreecommitdiff
path: root/grc/src/platforms/python/Port.py
diff options
context:
space:
mode:
authorjblum2009-02-06 19:01:10 +0000
committerjblum2009-02-06 19:01:10 +0000
commitc077a28498d2691f28e34846667575a8c4dc6859 (patch)
tree37df84b3c15508ace6f5668e10d7713db0186be8 /grc/src/platforms/python/Port.py
parentf23f2dee67cf7a0e3aa7ccfbf889ecc2177826bf (diff)
downloadgnuradio-c077a28498d2691f28e34846667575a8c4dc6859.tar.gz
gnuradio-c077a28498d2691f28e34846667575a8c4dc6859.tar.bz2
gnuradio-c077a28498d2691f28e34846667575a8c4dc6859.zip
grc: better handling of disabled elements
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10403 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'grc/src/platforms/python/Port.py')
-rw-r--r--grc/src/platforms/python/Port.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/grc/src/platforms/python/Port.py b/grc/src/platforms/python/Port.py
index e75b47e4b..73ec07242 100644
--- a/grc/src/platforms/python/Port.py
+++ b/grc/src/platforms/python/Port.py
@@ -46,6 +46,13 @@ class Port(_Port):
self._vlen = vlen
self._optional = bool(optional)
+ 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.')
+
def get_vlen(self):
"""
Get the vector length.
@@ -98,15 +105,6 @@ class Port(_Port):
}[self.get_type()]
except: return _Port.get_color(self)
- def is_empty(self):
- """
- Is this port empty?
- An empty port has no connections.
- Not empty of optional is set.
- @return true if empty
- """
- return not self.get_optional() and not self.get_connections()
-
class Source(Port):
def __init__(self, block, n):