Merge branch 'wxgui' of git@gnuradio.org:jblum into grc
authorJosh Blum <josh@joshknows.com>
Tue, 25 Aug 2009 04:35:46 +0000 (21:35 -0700)
committerJosh Blum <josh@joshknows.com>
Tue, 25 Aug 2009 04:35:46 +0000 (21:35 -0700)
22 files changed:
gnuradio-core/src/python/gnuradio/blks2impl/pfb_arb_resampler.py
gnuradio-examples/python/pfb/Makefile.am
gnuradio-examples/python/pfb/resampler_demo.grc [new file with mode: 0644]
grc/Makefile.inc
grc/base/Block.py
grc/base/Platform.py
grc/base/Port.py
grc/blocks/Makefile.am
grc/blocks/blks2_pfb_arb_resampler.xml [new file with mode: 0644]
grc/blocks/block_tree.xml
grc/blocks/pad_sink.xml
grc/blocks/pad_source.xml
grc/gui/ActionHandler.py
grc/gui/Actions.py
grc/gui/Bars.py
grc/gui/Dialogs.py
grc/gui/Platform.py
grc/gui/Port.py
grc/python/Platform.py
grc/python/Port.py
grc/python/flow_graph.tmpl
grc/todo.txt

index b1b3dfcab57d5bbc5650e6b78c54f0299faa2f77..e40d9636ad8fdf9fdfc9e75c3703d732a13297a4 100644 (file)
@@ -24,7 +24,7 @@ from gnuradio import gr
 
 class pfb_arb_resampler_ccf(gr.hier_block2):
     '''
-    Convinience wrapper for the polyphase filterbank arbitrary resampler.
+    Convenience wrapper for the polyphase filterbank arbitrary resampler.
 
     The block takes a single complex stream in and outputs a single complex
     stream out. As such, it requires no extra glue to handle the input/output
@@ -45,6 +45,5 @@ class pfb_arb_resampler_ccf(gr.hier_block2):
         self.connect(self, self.pfb)
         self.connect(self.pfb, self)
         
-        
-        
-        
+    def set_taps(self, taps):
+        self.pfb.set_taps(taps)
index 4aa9248eadf9d4e920601cd3f1eb36a79d7d9b3c..0b91d0a2daa885f8f8f3301ce0bc08f6978ba13e 100644 (file)
@@ -29,3 +29,6 @@ dist_ourdata_SCRIPTS =                \
        decimate.py             \
        interpolate.py          \
        fmtest.py
+
+dist_ourdata_DATA =            \
+       resampler_demo.grc
diff --git a/gnuradio-examples/python/pfb/resampler_demo.grc b/gnuradio-examples/python/pfb/resampler_demo.grc
new file mode 100644 (file)
index 0000000..468636a
--- /dev/null
@@ -0,0 +1,598 @@
+<?xml version='1.0' encoding='ASCII'?>
+<flow_graph>
+  <timestamp>Sun Aug 23 11:39:47 2009</timestamp>
+  <block>
+    <key>options</key>
+    <param>
+      <key>id</key>
+      <value>resampler_demo</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>title</key>
+      <value></value>
+    </param>
+    <param>
+      <key>author</key>
+      <value></value>
+    </param>
+    <param>
+      <key>description</key>
+      <value></value>
+    </param>
+    <param>
+      <key>window_size</key>
+      <value>1280, 1024</value>
+    </param>
+    <param>
+      <key>generate_options</key>
+      <value>wx_gui</value>
+    </param>
+    <param>
+      <key>category</key>
+      <value>Custom</value>
+    </param>
+    <param>
+      <key>run</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>realtime_scheduling</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(10, 10)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>import</key>
+    <param>
+      <key>id</key>
+      <value>import_0</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>import</key>
+      <value>import math</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(11, 59)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>variable</key>
+    <param>
+      <key>id</key>
+      <value>rs_taps</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>firdes.low_pass(nphases, nphases, frac_bw, 0.5-frac_bw)</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(273, 154)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>gr_add_const_vxx</key>
+    <param>
+      <key>id</key>
+      <value>adder</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>float</value>
+    </param>
+    <param>
+      <key>const</key>
+      <value>-1.0</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(227, 303)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>gr_throttle</key>
+    <param>
+      <key>id</key>
+      <value>throttle</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>float</value>
+    </param>
+    <param>
+      <key>samples_per_second</key>
+      <value>samp_rate</value>
+    </param>
+    <param>
+      <key>vlen</key>
+      <value>1</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(227, 493)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>wxgui_fftsink2</key>
+    <param>
+      <key>id</key>
+      <value>orig_fft</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>complex</value>
+    </param>
+    <param>
+      <key>title</key>
+      <value>Original Spectrum</value>
+    </param>
+    <param>
+      <key>samp_rate</key>
+      <value>samp_rate</value>
+    </param>
+    <param>
+      <key>baseband_freq</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>y_per_div</key>
+      <value>10</value>
+    </param>
+    <param>
+      <key>y_divs</key>
+      <value>10</value>
+    </param>
+    <param>
+      <key>ref_level</key>
+      <value>30</value>
+    </param>
+    <param>
+      <key>fft_size</key>
+      <value>1024</value>
+    </param>
+    <param>
+      <key>fft_rate</key>
+      <value>30</value>
+    </param>
+    <param>
+      <key>peak_hold</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>average</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>avg_alpha</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>grid_pos</key>
+      <value>1, 0, 1, 3</value>
+    </param>
+    <param>
+      <key>notebook</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(409, 289)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>180</value>
+    </param>
+  </block>
+  <block>
+    <key>wxgui_fftsink2</key>
+    <param>
+      <key>id</key>
+      <value>resamp_fft</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>complex</value>
+    </param>
+    <param>
+      <key>title</key>
+      <value>Resampled Spectrum</value>
+    </param>
+    <param>
+      <key>samp_rate</key>
+      <value>new_rate</value>
+    </param>
+    <param>
+      <key>baseband_freq</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>y_per_div</key>
+      <value>10</value>
+    </param>
+    <param>
+      <key>y_divs</key>
+      <value>10</value>
+    </param>
+    <param>
+      <key>ref_level</key>
+      <value>30</value>
+    </param>
+    <param>
+      <key>fft_size</key>
+      <value>1024</value>
+    </param>
+    <param>
+      <key>fft_rate</key>
+      <value>30</value>
+    </param>
+    <param>
+      <key>peak_hold</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>average</key>
+      <value>False</value>
+    </param>
+    <param>
+      <key>avg_alpha</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>grid_pos</key>
+      <value>2, 0, 1, 3</value>
+    </param>
+    <param>
+      <key>notebook</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(640, 256)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>180</value>
+    </param>
+  </block>
+  <block>
+    <key>gr_sig_source_x</key>
+    <param>
+      <key>id</key>
+      <value>tri_source</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>type</key>
+      <value>float</value>
+    </param>
+    <param>
+      <key>samp_rate</key>
+      <value>samp_rate</value>
+    </param>
+    <param>
+      <key>waveform</key>
+      <value>gr.GR_TRI_WAVE</value>
+    </param>
+    <param>
+      <key>freq</key>
+      <value>0.05</value>
+    </param>
+    <param>
+      <key>amp</key>
+      <value>2.0</value>
+    </param>
+    <param>
+      <key>offset</key>
+      <value>0</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(21, 271)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>gr_frequency_modulator_fc</key>
+    <param>
+      <key>id</key>
+      <value>fm_mod</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>sensitivity</key>
+      <value>math.pi</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(411, 493)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>blks2_pfb_arb_resampler_ccf</key>
+    <param>
+      <key>id</key>
+      <value>resampler</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>rate</key>
+      <value>float(new_rate)/samp_rate</value>
+    </param>
+    <param>
+      <key>taps</key>
+      <value>rs_taps</value>
+    </param>
+    <param>
+      <key>size</key>
+      <value>nphases</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(641, 477)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>variable</key>
+    <param>
+      <key>id</key>
+      <value>nphases</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>32</value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(185, 153)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>variable_static_text</key>
+    <param>
+      <key>id</key>
+      <value>samp_rate</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>Sample Rate</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>44100</value>
+    </param>
+    <param>
+      <key>converver</key>
+      <value>float_converter</value>
+    </param>
+    <param>
+      <key>formatter</key>
+      <value>None</value>
+    </param>
+    <param>
+      <key>grid_pos</key>
+      <value>0, 0, 1, 1</value>
+    </param>
+    <param>
+      <key>notebook</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(179, 14)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>variable_static_text</key>
+    <param>
+      <key>id</key>
+      <value>new_rate</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>Resampled Rate</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>48000</value>
+    </param>
+    <param>
+      <key>converver</key>
+      <value>float_converter</value>
+    </param>
+    <param>
+      <key>formatter</key>
+      <value>None</value>
+    </param>
+    <param>
+      <key>grid_pos</key>
+      <value>0, 1, 1, 1</value>
+    </param>
+    <param>
+      <key>notebook</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(328, 15)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <block>
+    <key>variable_static_text</key>
+    <param>
+      <key>id</key>
+      <value>frac_bw</value>
+    </param>
+    <param>
+      <key>_enabled</key>
+      <value>True</value>
+    </param>
+    <param>
+      <key>label</key>
+      <value>Fractional Bandwidth</value>
+    </param>
+    <param>
+      <key>value</key>
+      <value>0.45</value>
+    </param>
+    <param>
+      <key>converver</key>
+      <value>float_converter</value>
+    </param>
+    <param>
+      <key>formatter</key>
+      <value>lambda x: "%0.2f"%x</value>
+    </param>
+    <param>
+      <key>grid_pos</key>
+      <value>0,2,1,1</value>
+    </param>
+    <param>
+      <key>notebook</key>
+      <value></value>
+    </param>
+    <param>
+      <key>_coordinate</key>
+      <value>(473, 14)</value>
+    </param>
+    <param>
+      <key>_rotation</key>
+      <value>0</value>
+    </param>
+  </block>
+  <connection>
+    <source_block_id>tri_source</source_block_id>
+    <sink_block_id>adder</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>adder</source_block_id>
+    <sink_block_id>throttle</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>resampler</source_block_id>
+    <sink_block_id>resamp_fft</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>fm_mod</source_block_id>
+    <sink_block_id>resampler</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>fm_mod</source_block_id>
+    <sink_block_id>orig_fft</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+  <connection>
+    <source_block_id>throttle</source_block_id>
+    <sink_block_id>fm_mod</sink_block_id>
+    <source_key>0</source_key>
+    <sink_key>0</sink_key>
+  </connection>
+</flow_graph>
index 96ee11b67e721d44581a5c1d296ae6f287ca497c..c45d1ce1f33bee6cd49262aa8016f43a25447d0f 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2008 Free Software Foundation, Inc.
+# Copyright 2008, 2009 Free Software Foundation, Inc.
 #
 # This file is part of GNU Radio
 #
@@ -20,5 +20,5 @@
 #
 
 include $(top_srcdir)/Makefile.common
-grc_src_prefix = $(pythondir)/gnuradio/grc
+grc_src_prefix = $(pkgpythondir)/grc
 grc_blocksdir = $(pkgdatadir)/grc/blocks
index d5e1047852b7df5bfcd71b89135483debc183f18..349e71f76b212f322d42a479161735186941cd64 100644 (file)
@@ -47,7 +47,9 @@ class TemplateArg(UserDict):
                return self._param.get_evaluated()
 
 def _get_keys(lst): return [elem.get_key() for elem in lst]
-def _get_elem(lst, key): return lst[_get_keys(lst).index(key)]
+def _get_elem(lst, key):
+       try: return lst[_get_keys(lst).index(key)]
+       except ValueError: raise ValueError, 'Key "%s" not found in %s.'%(key, _get_keys(lst))
 
 class Block(Element):
 
@@ -98,7 +100,7 @@ class Block(Element):
                        self.get_params().append(param)
                #create the source objects
                self._sources = list()
-               for source in map(lambda n: self.get_parent().get_parent().Source(self, n), sources):
+               for source in map(lambda n: self.get_parent().get_parent().Port(self, n, dir='source'), sources):
                        key = source.get_key()
                        #test against repeated keys
                        try: assert key not in self.get_source_keys()
@@ -107,7 +109,7 @@ class Block(Element):
                        self.get_sources().append(source)
                #create the sink objects
                self._sinks = list()
-               for sink in map(lambda n: self.get_parent().get_parent().Sink(self, n), sinks):
+               for sink in map(lambda n: self.get_parent().get_parent().Port(self, n, dir='sink'), sinks):
                        key = sink.get_key()
                        #test against repeated keys
                        try: assert key not in self.get_sink_keys()
index 02d6d2319257e969c1b8b4f151b02556698df6ab..db7ade9a3a941f097c0873ae0295e106e27e024c 100644 (file)
@@ -171,6 +171,5 @@ class Platform(_Element):
        FlowGraph = _FlowGraph
        Connection = _Connection
        Block = _Block
-       Source = _Port
-       Sink = _Port
+       Port = _Port
        Param = _Param
index f4e8e5e1fb2a6f648aef6118b545b5a9e0d3354d..8e60d50931c3e91f60203c6d3c93c9d911c472f4 100644 (file)
@@ -24,22 +24,20 @@ class Port(Element):
        ##possible port types
        TYPES = []
 
-       def __init__(self, block, n):
+       def __init__(self, block, n, dir):
                """
                Make a new port from nested data.
                @param block the parent element
                @param n the nested odict
-               @return a new port
+               @param dir the direction source or sink
                """
-               #grab the data
-               name = n['name']
-               key = n['key']
-               type = n['type']
                #build the port
                Element.__init__(self, block)
-               self._name = name
-               self._key = key
-               self._type = type
+               #grab the data
+               self._name = n['name']
+               self._key = n['key']
+               self._type = n['type']
+               self._dir = dir
 
        def validate(self):
                """
@@ -60,8 +58,8 @@ class Port(Element):
        def get_color(self): return '#FFFFFF'
        def get_name(self): return self._name
        def get_key(self): return self._key
-       def is_sink(self): return self in self.get_parent().get_sinks()
-       def is_source(self): return self in self.get_parent().get_sources()
+       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)
 
        def get_connections(self):
index fbd8f4bb4dace7e169f4a3f640691815e703c1f3..caae6ce7540e7c8465a91c94d4feb23ce8ab8376 100644 (file)
@@ -45,6 +45,7 @@ dist_ourdata_DATA = \
        blks2_ofdm_mod.xml \
        blks2_packet_decoder.xml \
        blks2_packet_encoder.xml \
+       blks2_pfb_arb_resampler.xml \
        blks2_qamx_demod.xml \
        blks2_qamx_mod.xml \
        blks2_rational_resampler_xxx.xml \
diff --git a/grc/blocks/blks2_pfb_arb_resampler.xml b/grc/blocks/blks2_pfb_arb_resampler.xml
new file mode 100644 (file)
index 0000000..062b0dd
--- /dev/null
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Polyphase Arbitrary Resampler
+###################################################
+ -->
+<block>
+       <name>Polyphase Resampler</name>
+       <key>blks2_pfb_arb_resampler_ccf</key>
+       <import>from gnuradio import blks2</import>
+       <import>from gnuradio.gr import firdes</import>
+       <make>blks2.pfb_arb_resampler_ccf(
+       $rate,
+       $taps,
+       $size,
+)</make>
+       <callback>set_taps($taps)</callback>
+       <param>
+               <name>Resample Rate</name>
+               <key>rate</key>
+               <type>real</type>
+       </param>
+       <param>
+               <name>Taps</name>
+               <key>taps</key>
+               <type>real_vector</type>
+       </param>
+       <param>
+               <name>Size (# phases)</name>
+               <key>size</key>
+               <value>32</value>
+               <type>int</type>
+       </param>
+       <sink>
+               <name>in</name>
+               <type>complex</type>
+       </sink>
+       <source>
+               <name>out</name>
+               <type>complex</type>
+       </source>
+</block>
index 2cedb45a2a7dbb376f54a7cc0ccf53b24b9a1b9c..5b45466f59289a25759b88bc5322debd24ca87e9 100644 (file)
                <!-- Filter banks -->
                <block>blks2_synthesis_filterbank</block>
                <block>blks2_analysis_filterbank</block>
+               <!-- Polyphase filers -->
+               <block>blks2_pfb_arb_resampler_ccf</block>
                <!-- Other filters -->
                <block>gr_single_pole_iir_filter_xx</block>
                <block>gr_hilbert_fc</block>
index 477f2ad13a044a8911bd2e8db37488fdb522059a..999de315dbb166f7b057459d375be982e6a8401e 100644 (file)
@@ -8,6 +8,20 @@
        <name>Pad Sink</name>
        <key>pad_sink</key>
        <make></make>
+       <param>
+               <name>Mode</name>
+               <key>mode</key>
+               <value>hb</value>
+               <type>enum</type>
+               <option>
+                       <name>Hierarchical</name>
+                       <key>hb</key>
+               </option>
+               <option>
+                       <name>Continuation</name>
+                       <key>cont</key>
+               </option>
+       </param>
        <param>
                <name>Num Inputs</name>
                <key>nports</key>
                <nports>$nports</nports>
        </sink>
        <doc>
-This is a sink pad block for creating hierarchical flow graphs. \
+Continuation Mode:
+The inputs of this block can be aliased by one or more pad source blocks.
+
+Hierarchical Mode:
 The inputs of this block will become the outputs to this flow graph when it is instantiated as a hierarchical block. \
 Limit one sink pad block per flow graph.
-
-Remember to set the generate options to hier block.
        </doc>
 </block>
index b6ef2c55d1e2f2e6bbc3770ff066716d4da2b644..26491adb3986b16455e3ae07b0eac7f3b43263b2 100644 (file)
@@ -8,6 +8,20 @@
        <name>Pad Source</name>
        <key>pad_source</key>
        <make></make>
+       <param>
+               <name>Mode</name>
+               <key>mode</key>
+               <value>hb</value>
+               <type>enum</type>
+               <option>
+                       <name>Hierarchical</name>
+                       <key>hb</key>
+               </option>
+               <option>
+                       <name>Continuation</name>
+                       <key>cont</key>
+               </option>
+       </param>
        <param>
                <name>Num Outputs</name>
                <key>nports</key>
                <value>1</value>
                <type>int</type>
        </param>
+       <param>
+               <name>Pad Sink ID</name>
+               <key>pad_sink_id</key>
+               <value>pad_sink_0</value>
+               <type>string</type>
+               <hide>#if $mode() == 'cont' then 'none' else 'all'#</hide>
+       </param>
        <check>$vlen &gt; 0</check>
        <check>0 &lt; $nports</check>
        <source>
                <nports>$nports</nports>
        </source>
        <doc>
-This is a source pad block for creating hierarchical flow graphs. \
-The outputs of this block will become the inputs to this flow graph when it is instantiated as a hierarchical block. \
-Limit one source pad block per flow graph.
+Continuation Mode:
+The outputs of this block will alias the inputs of the pad sink specified by "pad sink id".
 
-Remember to set the generate options to hier block.
+Hierarchical Mode:
+The outputs of this block will become the inputs to this flow graph when it is instantiated as a hierarchical block. \
+Limit one source pad block per flow graph. \
+The "pad sink id" will be ignored in this mode.
        </doc>
 </block>
index ff137f6697074b657ece3f5ab2d90ce6a2db2c50..9af580e8e1e5721ad7c3f65cff0065eac69b5825 100644 (file)
@@ -133,7 +133,7 @@ class ActionHandler:
                                Actions.FLOW_GRAPH_OPEN, Actions.FLOW_GRAPH_SAVE_AS,
                                Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY,
                                Actions.FLOW_GRAPH_SCREEN_CAPTURE, Actions.HELP_WINDOW_DISPLAY,
-                               Actions.COLORS_WINDOW_DISPLAY,
+                               Actions.TYPES_WINDOW_DISPLAY,
                        ): Actions.get_action_from_name(action).set_sensitive(True)
                        if not self.init_file_paths:
                                self.init_file_paths = Preferences.files_open()
@@ -237,8 +237,8 @@ class ActionHandler:
                        Dialogs.AboutDialog(self.get_flow_graph().get_parent())
                elif state == Actions.HELP_WINDOW_DISPLAY:
                        Dialogs.HelpDialog()
-               elif state == Actions.COLORS_WINDOW_DISPLAY:
-                       Dialogs.ColorsDialog(self.get_flow_graph().get_parent())
+               elif state == Actions.TYPES_WINDOW_DISPLAY:
+                       Dialogs.TypesDialog(self.get_flow_graph().get_parent())
                ##################################################
                # Param Modifications
                ##################################################
index 3695e09ef3d7abdddc7b178d132099f83f46e92d..c3ef2711acb053433c9ea0ea6a23dbfac469fcdd 100644 (file)
@@ -57,7 +57,7 @@ FLOW_GRAPH_KILL = 'flow graph kill'
 FLOW_GRAPH_SCREEN_CAPTURE = 'flow graph screen capture'
 ABOUT_WINDOW_DISPLAY = 'about window display'
 HELP_WINDOW_DISPLAY = 'help window display'
-COLORS_WINDOW_DISPLAY = 'colors window display'
+TYPES_WINDOW_DISPLAY = 'types window display'
 
 ######################################################################################################
 # Action Key Map
@@ -132,7 +132,7 @@ _actions_list = (
        gtk.Action(BLOCK_PASTE, '_Paste', 'Paste', gtk.STOCK_PASTE),
        gtk.Action(ABOUT_WINDOW_DISPLAY, '_About', 'About this program', gtk.STOCK_ABOUT),
        gtk.Action(HELP_WINDOW_DISPLAY, '_Help', 'Usage Tips', gtk.STOCK_HELP),
-       gtk.Action(COLORS_WINDOW_DISPLAY, '_Colors', 'Color Mapping', gtk.STOCK_DIALOG_INFO),
+       gtk.Action(TYPES_WINDOW_DISPLAY, '_Types', 'Types Color Mapping', gtk.STOCK_DIALOG_INFO),
        gtk.Action(FLOW_GRAPH_GEN, '_Generate', 'Generate the flow graph', gtk.STOCK_CONVERT),
        gtk.Action(FLOW_GRAPH_EXEC, '_Execute', 'Execute the flow graph', gtk.STOCK_EXECUTE),
        gtk.Action(FLOW_GRAPH_KILL, '_Kill', 'Kill the flow graph', gtk.STOCK_STOP),
index e0c547eba5348af90130848d0c4b737aff961cdf..697d48a3ced7c3bea8a578c4ae10d0db8f47b1b8 100644 (file)
@@ -88,7 +88,7 @@ MENU_BAR_LIST = (
        ]),
        (gtk.Action('Help', '_Help', None, None), [
                Actions.HELP_WINDOW_DISPLAY,
-               Actions.COLORS_WINDOW_DISPLAY,
+               Actions.TYPES_WINDOW_DISPLAY,
                None,
                Actions.ABOUT_WINDOW_DISPLAY,
        ]),
index 8d764e28e38e8584302026ccae4fbde33133495d..3cf617b92c8e03b1a06fdd6d6e457dd8a450f613 100644 (file)
@@ -98,8 +98,8 @@ COLORS_DIALOG_MARKUP_TMPL = """\
 #end if
 """
 
-def ColorsDialog(platform): MessageDialogHelper(
+def TypesDialog(platform): MessageDialogHelper(
        type=gtk.MESSAGE_INFO,
        buttons=gtk.BUTTONS_CLOSE,
-       title='Colors',
+       title='Types',
        markup=Utils.parse_template(COLORS_DIALOG_MARKUP_TMPL, colors=platform.get_colors()))
index a32b0209ffb2815c2e769a673dac58af1239b26a..1530a69d63f11cbe7d74eb8d92836a946337e4bc 100644 (file)
@@ -1,5 +1,5 @@
 """
-Copyright 2008 Free Software Foundation, Inc.
+Copyright 2008, 2009 Free Software Foundation, Inc.
 This file is part of GNU Radio
 
 GNU Radio Companion is free software; you can redistribute it and/or
@@ -38,8 +38,7 @@ def Platform(platform):
                ('FlowGraph', FlowGraph),
                ('Connection', Connection),
                ('Block', Block),
-               ('Source', Port),
-               ('Sink', Port),
+               ('Port', Port),
                ('Param', Param),
        ):
                old_value = getattr(platform, attr)
index d1f36f8b963659aea5d5e8130c8def7ffb3bd965..6fc2c4b155aeec04f26cb69131aa3065d0aab628 100644 (file)
@@ -1,5 +1,5 @@
 """
-Copyright 2007 Free Software Foundation, Inc.
+Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
 This file is part of GNU Radio
 
 GNU Radio Companion is free software; you can redistribute it and/or
index d55dbf4ce71a224fa89fd710a396f466db7c2391..cab25d348fd3d29665095c77bc3ba2eb33f8f729 100644 (file)
@@ -23,7 +23,7 @@ from .. base.Platform import Platform as _Platform
 from FlowGraph import FlowGraph as _FlowGraph
 from Connection import Connection as _Connection
 from Block import Block as _Block
-from Port import Source,Sink
+from Port import Port as _Port
 from Param import Param as _Param
 from Generator import Generator
 from Constants import \
@@ -77,6 +77,5 @@ class Platform(_Platform):
        FlowGraph = _FlowGraph
        Connection = _Connection
        Block = _Block
-       Source = Source
-       Sink = Sink
+       Port = _Port
        Param = _Param
index daf8f9ca34c1f687fffc3e54dac26af3dc35b6e3..f71c5fa35f87e768a979c4cc84e471deb3408704 100644 (file)
@@ -25,17 +25,27 @@ class Port(_Port):
        ##possible port types
        TYPES = ['complex', 'float', 'int', 'short', 'byte', 'msg']
 
-       def __init__(self, block, n):
+       def __init__(self, block, n, dir):
                """
                Make a new port from nested data.
                @param block the parent element
                @param n the nested odict
+               @param dir the direction
                """
+               self._n = n
+               if n['type'] == 'msg': n['key'] = 'msg'
+               if dir == 'source' and not n.find('key'):
+                       n['key'] = str(block._source_count)
+                       block._source_count += 1
+               if dir == 'sink' and not n.find('key'):
+                       n['key'] = str(block._sink_count)
+                       block._sink_count += 1
                #build the port
                _Port.__init__(
                        self,
                        block=block,
                        n=n,
+                       dir=dir,
                )
                self._nports = n.find('nports') or ''
                self._vlen = n.find('vlen') or ''
@@ -109,24 +119,4 @@ class Port(_Port):
        def copy(self, new_key=None):
                n = self._n.copy()
                if new_key: n['key'] = new_key
-               return self.__class__(self.get_parent(), n)
-
-class Source(Port):
-
-       def __init__(self, block, n):
-               self._n = n #save n
-               if n['type'] == 'msg': n['key'] = 'msg'
-               if not n.find('key'):
-                       n['key'] = str(block._source_count)
-                       block._source_count = block._source_count + 1
-               Port.__init__(self, block, n)
-
-class Sink(Port):
-
-       def __init__(self, block, n):
-               self._n = n #save n
-               if n['type'] == 'msg': n['key'] = 'msg'
-               if not n.find('key'):
-                       n['key'] = str(block._sink_count)
-                       block._sink_count = block._sink_count + 1
-               Port.__init__(self, block, n)
+               return self.__class__(self.get_parent(), n, self._dir)
index df346dd165567002a34fcfbcd2787818ef43cbea..32139636af8fcdec8aa319ec1e7a714a219052df 100644 (file)
@@ -161,8 +161,20 @@ class $(class_name)(gr.hier_block2):
                $DIVIDER
 #end if
 #for $con in $connections
+       ####################################################################
+       ## Logic to extract source and sink
+       ##   Special resolution logic for pad source in continuation mode
+       ####################################################################
        #set $source = $con.get_source()
        #set $sink = $con.get_sink()
+       #if $source.get_parent().get_key() == 'pad_source' and $source.get_parent().get_param('mode').get_value() == 'cont'
+               #set $pad_sink_id = $source.get_parent().get_param('pad_sink_id').get_evaluated()
+               #set $pad_sink = filter(lambda b: b.get_id() == pad_sink_id, $blocks)[0]
+               #set $source = $pad_sink.get_sink($source.get_key()).get_connections()[0].get_source()
+       #end if
+       ####################################################################
+       ## Logic to extract source and sink names
+       ####################################################################
        #if $source.get_parent().get_key() == 'pad_source'
                #set $source_name = 'self'
        #else
@@ -173,7 +185,12 @@ class $(class_name)(gr.hier_block2):
        #else
                #set $sink_name = 'self.' + $sink.get_parent().get_id()
        #end if
+       ####################################################################
+       ## Dont make a connection for continuation pad sinks!!!
+       ####################################################################
+       #if not ($sink.get_parent().get_key() == 'pad_sink' and $sink.get_parent().get_param('mode').get_value() == 'cont')
                self.connect(($source_name, $source.get_key()), ($sink_name, $sink.get_key()))
+       #end if
 #end for
 
 ########################################################
index bb40e1f160fe4009dec974596cefed2ca38f0284..577e4c3308799f180a7b2dc604a6aa7213bf1fd8 100644 (file)
@@ -59,6 +59,8 @@
 ##################################################
 # Problems
 ##################################################
+* need a way to make an id param in the xml that will override the default
+  * ex: display pad sink id in continuation mode using hide tag for id param
 * hier block generation
   * auto generate hier library on changes
   * auto clean hier library when block removed