diff options
Diffstat (limited to 'grc/src/platforms/python/Port.py')
-rw-r--r-- | grc/src/platforms/python/Port.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/grc/src/platforms/python/Port.py b/grc/src/platforms/python/Port.py index e75b47e4b0..73ec07242b 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): |