diff options
Diffstat (limited to 'gr-howto-write-a-block/apps/howto_square.py')
-rwxr-xr-x | gr-howto-write-a-block/apps/howto_square.py | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/gr-howto-write-a-block/apps/howto_square.py b/gr-howto-write-a-block/apps/howto_square.py index f14e28325d..140067b59f 100755 --- a/gr-howto-write-a-block/apps/howto_square.py +++ b/gr-howto-write-a-block/apps/howto_square.py @@ -2,17 +2,18 @@ ################################################## # Gnuradio Python Flow Graph # Title: Howto Square -# Generated: Thu Nov 12 11:26:07 2009 +# Generated: Sun Sep 30 13:32:52 2012 ################################################## -import howto from gnuradio import eng_notation from gnuradio import gr +from gnuradio import blocks from gnuradio.eng_option import eng_option from gnuradio.gr import firdes from gnuradio.wxgui import scopesink2 from grc_gnuradio import wxgui as grc_wxgui from optparse import OptionParser +import howto import wx class howto_square(grc_wxgui.top_block_gui): @@ -28,33 +29,37 @@ class howto_square(grc_wxgui.top_block_gui): ################################################## # Blocks ################################################## - self.sink = scopesink2.scope_sink_f( + self.thr = blocks.throttle(gr.sizeof_float*1, samp_rate) + self.src = gr.vector_source_f(([float(n)-50 for n in range(100)]), True, 1) + self.sqr = howto.square_ff() + self.sink2 = scopesink2.scope_sink_f( self.GetWin(), - title="Input", + title="Output", sample_rate=samp_rate, - v_scale=20, + v_scale=0, v_offset=0, t_scale=0.002, ac_couple=False, xy_mode=False, num_inputs=1, + trig_mode=gr.gr_TRIG_MODE_AUTO, + y_axis_label="Counts", ) - self.Add(self.sink.win) - self.sink2 = scopesink2.scope_sink_f( + self.Add(self.sink2.win) + self.sink = scopesink2.scope_sink_f( self.GetWin(), - title="Output", + title="Input", sample_rate=samp_rate, - v_scale=0, + v_scale=20, v_offset=0, t_scale=0.002, ac_couple=False, xy_mode=False, num_inputs=1, + trig_mode=gr.gr_TRIG_MODE_AUTO, + y_axis_label="Counts", ) - self.Add(self.sink2.win) - self.sqr = howto.square_ff() - self.src = gr.vector_source_f(([float(n)-50 for n in range(100)]), True, 1) - self.thr = gr.throttle(gr.sizeof_float*1, samp_rate) + self.Add(self.sink.win) ################################################## # Connections @@ -64,6 +69,11 @@ class howto_square(grc_wxgui.top_block_gui): self.connect((self.thr, 0), (self.sink, 0)) self.connect((self.sqr, 0), (self.sink2, 0)) +# QT sink close method reimplementation + + def get_samp_rate(self): + return self.samp_rate + def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.sink.set_sample_rate(self.samp_rate) |