commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] [gnuradio] 36/101: grc: keep list of active ports in c


From: git
Subject: [Commit-gnuradio] [gnuradio] 36/101: grc: keep list of active ports in core blocks
Date: Thu, 16 Mar 2017 14:58:03 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch python3
in repository gnuradio.

commit db5ab0f2a0e694ca9149d66171e0dbbb87dd74da
Author: Sebastian Koslowski <address@hidden>
Date:   Tue Jul 12 17:40:40 2016 +0200

    grc: keep list of active ports in core blocks
---
 grc/core/Block.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/grc/core/Block.py b/grc/core/Block.py
index 631dabc..9bcb6e6 100644
--- a/grc/core/Block.py
+++ b/grc/core/Block.py
@@ -101,6 +101,8 @@ class Block(Element):
         self.port_counters = [itertools.count(), itertools.count()]
         self.sources = self._init_ports(sources_n, direction='source')
         self.sinks = self._init_ports(sinks_n, direction='sink')
+        self.active_sources = []  # on rewrite
+        self.active_sinks = []  # on rewrite
 
         self.states = {'_enabled': True}
 
@@ -253,6 +255,9 @@ class Block(Element):
                 port.key = str(domain_specific_port_index[domain])
                 domain_specific_port_index[domain] += 1
 
+        self.active_sources = [p for p in self.get_sources_gui() if not 
p.get_hide()]
+        self.active_sinks = [p for p in self.get_sinks_gui() if not 
p.get_hide()]
+
     def get_imports(self, raw=False):
         """
         Resolve all import statements.
@@ -497,7 +502,10 @@ class Block(Element):
         return self.sources + self.sinks
 
     def get_ports_gui(self):
-        return self.filter_bus_port(self.sources) + 
self.filter_bus_port(self.sinks)
+        return self.get_sources_gui() + self.get_sinks_gui()
+
+    def active_ports(self):
+        return itertools.chain(self.active_sources, self.active_sinks)
 
     def get_children(self):
         return self.get_ports() + self.params.values()
@@ -711,10 +719,12 @@ class Block(Element):
         except:
             return ''
 
-    def back_ofthe_bus(self, portlist):
+    @staticmethod
+    def back_ofthe_bus(portlist):
         portlist.sort(key=lambda p: p._type == 'bus')
 
-    def filter_bus_port(self, ports):
+    @staticmethod
+    def filter_bus_port(ports):
         buslist = [p for p in ports if p._type == 'bus']
         return buslist or ports
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]