diff options
-rw-r--r-- | grc/blocks/Makefile.am | 1 | ||||
-rw-r--r-- | grc/blocks/block_tree.xml | 1 | ||||
-rw-r--r-- | grc/blocks/virtual_sink.xml | 6 | ||||
-rw-r--r-- | grc/blocks/virtual_source.xml | 21 | ||||
-rw-r--r-- | grc/python/Port.py | 20 |
5 files changed, 44 insertions, 5 deletions
diff --git a/grc/blocks/Makefile.am b/grc/blocks/Makefile.am index 328661510..32ddc6567 100644 --- a/grc/blocks/Makefile.am +++ b/grc/blocks/Makefile.am @@ -219,6 +219,7 @@ dist_ourdata_DATA = \ variable_static_text.xml \ variable_text_box.xml \ virtual_sink.xml \ + virtual_source.xml \ wxgui_constellationsink2.xml \ wxgui_fftsink2.xml \ wxgui_histosink2.xml \ diff --git a/grc/blocks/block_tree.xml b/grc/blocks/block_tree.xml index 772320d1b..5a989cc01 100644 --- a/grc/blocks/block_tree.xml +++ b/grc/blocks/block_tree.xml @@ -22,6 +22,7 @@ <block>gr_wavfile_source</block> <block>gr_message_source</block> <block>pad_source</block> + <block>virtual_source</block> </cat> <cat> <name>Sinks</name> diff --git a/grc/blocks/virtual_sink.xml b/grc/blocks/virtual_sink.xml index 314fb3dc9..bd858522b 100644 --- a/grc/blocks/virtual_sink.xml +++ b/grc/blocks/virtual_sink.xml @@ -8,6 +8,12 @@ <name>Virtual Sink</name> <key>virtual_sink</key> <make></make> + <param> + <name>Stream ID</name> + <key>stream_id</key> + <value></value> + <type>string</type> + </param> <sink> <name>in</name> <type></type> diff --git a/grc/blocks/virtual_source.xml b/grc/blocks/virtual_source.xml new file mode 100644 index 000000000..11eb0c0fb --- /dev/null +++ b/grc/blocks/virtual_source.xml @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Virtual Source +################################################### + --> +<block> + <name>Virtual Source</name> + <key>virtual_source</key> + <make></make> + <param> + <name>Stream ID</name> + <key>stream_id</key> + <value></value> + <type>string</type> + </param> + <source> + <name>out</name> + <type></type> + </source> +</block> diff --git a/grc/python/Port.py b/grc/python/Port.py index dde736dba..b386e3f89 100644 --- a/grc/python/Port.py +++ b/grc/python/Port.py @@ -69,13 +69,23 @@ class Port(_Port): Handle the port cloning for virtual blocks. """ _Port.rewrite(self) - #virtual sink logic - if self.get_parent().get_key() == 'virtual_sink': - if self.get_enabled_connections(): #clone type and vlen - source = self.get_enabled_connections()[0].get_source() + if self.get_parent().get_key() in ('virtual_sink', 'virtual_source'): + try: + if self.get_parent().get_key() == 'virtual_sink': + source = self.get_enabled_connections()[0].get_source() + if self.get_parent().get_key() == 'virtual_source': + source = filter( + lambda vs: vs.get_param('stream_id').get_value() == self.get_parent().get_param('stream_id').get_value(), + filter( + lambda b: b.get_key() == 'virtual_sink', + self.get_parent().get_parent().get_enabled_blocks(), + ), + )[0].get_sink('0').get_enabled_connections()[0].get_source() + #clone type and vlen self._type = str(source.get_type()) self._vlen = str(source.get_vlen()) - else: #reset type and vlen + except: + #reset type and vlen self._type = '' self._vlen = '' |