[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 04/05: grc: undo port type caching (fixes t
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 04/05: grc: undo port type caching (fixes type controller) |
Date: |
Tue, 13 Jan 2015 20:52:29 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch maint
in repository gnuradio.
commit b307c892fb348ddb3613db33db4e874879185fde
Author: Sebastian Koslowski <address@hidden>
Date: Tue Jan 13 11:31:58 2015 +0100
grc: undo port type caching (fixes type controller)
---
grc/base/Block.py | 9 +++------
grc/base/Port.py | 11 ++++-------
grc/python/Port.py | 1 -
3 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/grc/base/Block.py b/grc/base/Block.py
index a8a699f..128cc5e 100644
--- a/grc/base/Block.py
+++ b/grc/base/Block.py
@@ -187,14 +187,11 @@ class Block(Element):
def back_ofthe_bus(self, portlist):
- portlist.sort(key=lambda a: a.get_type() == 'bus');
+ portlist.sort(key=lambda p: p._type == 'bus')
def filter_bus_port(self, ports):
- buslist = [i for i in ports if i.get_type() == 'bus'];
- if len(buslist) == 0:
- return ports;
- else:
- return buslist;
+ buslist = [p for p in ports if p._type == 'bus']
+ return buslist or ports
def get_enabled(self):
"""
diff --git a/grc/base/Port.py b/grc/base/Port.py
index b393ba9..6197089 100644
--- a/grc/base/Port.py
+++ b/grc/base/Port.py
@@ -40,7 +40,6 @@ class Port(Element):
self._domain = n['domain']
self._hide = n.find('hide') or ''
self._dir = dir
- self._type_evaluated = None # updated on rewrite()
self._hide_evaluated = False # updated on rewrite()
def validate(self):
@@ -58,13 +57,13 @@ class Port(Element):
def rewrite(self):
"""resolve dependencies in for type and hide"""
Element.rewrite(self)
- self._type_evaluated =
self.get_parent().resolve_dependencies(self._type)
hide =
self.get_parent().resolve_dependencies(self._hide).strip().lower()
self._hide_evaluated = False if hide in ('false', 'off', '0') else
bool(hide)
# update domain if was deduced from (dynamic) port type
- if self._domain == GR_STREAM_DOMAIN and self._type_evaluated ==
"message":
+ type_ = self.get_type()
+ if self._domain == GR_STREAM_DOMAIN and type_ == "message":
self._domain = GR_MESSAGE_DOMAIN
- if self._domain == GR_MESSAGE_DOMAIN and self._type_evaluated !=
"message":
+ if self._domain == GR_MESSAGE_DOMAIN and type_ != "message":
self._domain = GR_STREAM_DOMAIN
def __str__(self):
@@ -92,9 +91,7 @@ class Port(Element):
def get_key(self): return self._key
def is_sink(self): return self._dir == 'sink'
def is_source(self): return self._dir == 'source'
- def get_type(self):
- return self.get_parent().resolve_dependencies(self._type) \
- if self._type_evaluated is None else self._type_evaluated
+ def get_type(self): return
self.get_parent().resolve_dependencies(self._type)
def get_domain(self): return self._domain
def get_hide(self): return self._hide_evaluated
diff --git a/grc/python/Port.py b/grc/python/Port.py
index 4cd07a9..765e1d7 100644
--- a/grc/python/Port.py
+++ b/grc/python/Port.py
@@ -140,7 +140,6 @@ class Port(_Port, _GUIPort):
Handle the port cloning for virtual blocks.
"""
if self.is_type_empty():
- self._type_evaluated = None
try: #clone type and vlen
source = self.resolve_empty_type()
self._type = str(source.get_type())