[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r4770 - gnuradio/branches/developers/michaelld/scopesi
From: |
michaelld |
Subject: |
[Commit-gnuradio] r4770 - gnuradio/branches/developers/michaelld/scopesink/gr-wxgui/src/python |
Date: |
Sat, 17 Mar 2007 18:34:26 -0600 (MDT) |
Author: michaelld
Date: 2007-03-17 18:34:26 -0600 (Sat, 17 Mar 2007)
New Revision: 4770
Modified:
gnuradio/branches/developers/michaelld/scopesink/gr-wxgui/src/python/scopesink.py
Log:
Updated scopesink that fixes the 'size' issue as well as allows for
the user to provide a 'horizontal' BoxSizer for placing objects.
The primary difference from the user's perspective is that this
version doesn't have a ".win" property, since no wx.Panel is created;
instead the input "parent" is used for placing objects.
Modified:
gnuradio/branches/developers/michaelld/scopesink/gr-wxgui/src/python/scopesink.py
===================================================================
---
gnuradio/branches/developers/michaelld/scopesink/gr-wxgui/src/python/scopesink.py
2007-03-17 21:50:54 UTC (rev 4769)
+++
gnuradio/branches/developers/michaelld/scopesink/gr-wxgui/src/python/scopesink.py
2007-03-18 00:34:26 UTC (rev 4770)
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Copyright 2003,2004,2006 Free Software Foundation, Inc.
+# Copyright 2003,2004,2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -32,37 +32,246 @@
default_v_scale = 1000
default_frame_decim = gr.prefs().get_long('wxgui', 'frame_decim', 1)
-class scope_sink_f(gr.hier_block):
- def __init__(self, fg, parent, title='', sample_rate=1,
- size=default_scopesink_size, frame_decim=default_frame_decim,
- v_scale=default_v_scale, t_scale=None):
- msgq = gr.msg_queue(2) # message queue that holds at most 2
messages
- self.guts = gr.oscope_sink_f(sample_rate, msgq)
- gr.hier_block.__init__(self, fg, self.guts, self.guts)
- self.win = scope_window(win_info (msgq, sample_rate, frame_decim,
- v_scale, t_scale, self.guts, title),
parent)
+class scope_sink_base (gr.hier_block):
+ def __init__ (self, fg, parent, title, sample_rate, size,
+ frame_decim, v_scale, t_scale, vbox, do_c2f=False):
- def set_sample_rate(self, sample_rate):
- self.guts.set_sample_rate(sample_rate)
- self.win.info.set_sample_rate(sample_rate)
+ # message queue that holds at most 2 messages
+ msgq = gr.msg_queue (2)
+ self.guts = gr.oscope_sink_f (sample_rate, msgq)
+ if do_c2f:
+ c2f = gr.complex_to_float ()
+ fg.connect((c2f, 0), (self.guts, 0))
+ fg.connect((c2f, 1), (self.guts, 1))
+ gr.hier_block.__init__(self, fg, c2f, self.guts)
+ else:
+ gr.hier_block.__init__(self, fg, self.guts, self.guts)
-class scope_sink_c(gr.hier_block):
- def __init__(self, fg, parent, title='', sample_rate=1,
- size=default_scopesink_size, frame_decim=default_frame_decim,
- v_scale=default_v_scale, t_scale=None):
- msgq = gr.msg_queue(2) # message queue that holds at most 2
messages
- c2f = gr.complex_to_float()
- self.guts = gr.oscope_sink_f(sample_rate, msgq)
- fg.connect((c2f, 0), (self.guts, 0))
- fg.connect((c2f, 1), (self.guts, 1))
- gr.hier_block.__init__(self, fg, c2f, self.guts)
- self.win = scope_window(win_info(msgq, sample_rate, frame_decim,
- v_scale, t_scale, self.guts, title),
parent)
+ self.info = win_info (msgq, sample_rate, frame_decim,
+ v_scale, t_scale, self.guts, title)
+ self.graph = graph_window (self.info, parent, -1, size=size)
+
+ if not vbox:
+ vbox = wx.BoxSizer (wx.VERTICAL)
+
+ vbox.Add (self.graph, 1, wx.EXPAND)
+ vbox.Add (self.make_control_box (parent), 0, wx.EXPAND)
+ vbox.Add (self.make_control2_box (parent), 0, wx.EXPAND)
+
+ if not vbox:
+ self.sizer = vbox
+ self.SetSizer (self.sizer)
+ self.SetAutoLayout (True)
+ self.sizer.Fit (self)
+
+ self.set_autorange (self.info.autorange)
+
+ # second row of control buttons etc. appears BELOW control_box
+ def make_control2_box (self, parent):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ self.inc_v_button = wx.Button (parent, 1101, " < ",
style=wx.BU_EXACTFIT)
+ self.inc_v_button.SetToolTipString ("Increase vertical range")
+ wx.EVT_BUTTON (parent, 1101, self.incr_v_scale) # ID matches button ID
above
+
+ self.dec_v_button = wx.Button (parent, 1100, " > ",
style=wx.BU_EXACTFIT)
+ self.dec_v_button.SetToolTipString ("Decrease vertical range")
+ wx.EVT_BUTTON (parent, 1100, self.decr_v_scale)
+
+ self.v_scale_label = wx.StaticText (parent, 1002, "None") # vertical
/div
+ self.update_v_scale_label ()
+
+ self.autorange_checkbox = wx.CheckBox (parent, 1102, "Autorange")
+ self.autorange_checkbox.SetToolTipString ("Select autorange on/off")
+ wx.EVT_CHECKBOX(parent, 1102, self.autorange_checkbox_event)
+
+ ctrlbox.Add ((5,0) ,0) # left margin space
+ ctrlbox.Add (self.inc_v_button, 0, wx.EXPAND)
+ ctrlbox.Add (self.dec_v_button, 0, wx.EXPAND)
+ ctrlbox.Add (self.v_scale_label, 0, wx.ALIGN_CENTER)
+ ctrlbox.Add ((20,0) ,0) # spacer
+ ctrlbox.Add (self.autorange_checkbox, 0, wx.ALIGN_CENTER)
+
+ return ctrlbox
+
+ def make_control_box (self, parent):
+ ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
+
+ tb_left = wx.Button (parent, 1001, " < ", style=wx.BU_EXACTFIT)
+ tb_left.SetToolTipString ("Increase time base")
+ wx.EVT_BUTTON (parent, 1001, self.incr_timebase)
+
+
+ tb_right = wx.Button (parent, 1000, " > ", style=wx.BU_EXACTFIT)
+ tb_right.SetToolTipString ("Decrease time base")
+ wx.EVT_BUTTON (parent, 1000, self.decr_timebase)
+
+ self.time_base_label = wx.StaticText (parent, 1002, "")
+ self.update_timebase_label ()
+
+ ctrlbox.Add ((5,0) ,0)
+ # ctrlbox.Add (wx.StaticText (self, -1, "Horiz Scale: "), 0,
wx.ALIGN_CENTER)
+ ctrlbox.Add (tb_left, 0, wx.EXPAND)
+ ctrlbox.Add (tb_right, 0, wx.EXPAND)
+ ctrlbox.Add (self.time_base_label, 0, wx.ALIGN_CENTER)
+
+ ctrlbox.Add ((10,0) ,1) # stretchy space
+
+ ctrlbox.Add (wx.StaticText (parent, -1, "Trig: "), 0, wx.ALIGN_CENTER)
+ self.trig_chan_choice = wx.Choice (parent, 1004,
+ choices = ['Ch1', 'Ch2', 'Ch3',
'Ch4'])
+ self.trig_chan_choice.SetToolTipString ("Select channel for trigger")
+ wx.EVT_CHOICE (parent, 1004, self.trig_chan_choice_event)
+ ctrlbox.Add (self.trig_chan_choice, 0, wx.ALIGN_CENTER)
+
+ self.trig_mode_choice = wx.Choice (parent, 1005,
+ choices = ['Auto', 'Pos', 'Neg'])
+ self.trig_mode_choice.SetToolTipString ("Select trigger slope or Auto
(untriggered roll)")
+ wx.EVT_CHOICE (parent, 1005, self.trig_mode_choice_event)
+ ctrlbox.Add (self.trig_mode_choice, 0, wx.ALIGN_CENTER)
+
+ trig_level50 = wx.Button (parent, 1006, "50%")
+ trig_level50.SetToolTipString ("Set trigger level to 50%")
+ wx.EVT_BUTTON (parent, 1006, self.set_trig_level50)
+ ctrlbox.Add (trig_level50, 0, wx.EXPAND)
+
+ run_stop = wx.Button (parent, 1007, "Run/Stop")
+ run_stop.SetToolTipString ("Toggle Run/Stop mode")
+ wx.EVT_BUTTON (parent, 1007, self.run_stop)
+ ctrlbox.Add (run_stop, 0, wx.EXPAND)
+
+ ctrlbox.Add ((10, 0) ,1) # stretchy space
+
+ ctrlbox.Add (wx.StaticText (parent, -1, "Fmt: "), 0, wx.ALIGN_CENTER)
+ self.marker_choice = wx.Choice (parent, 1002, choices =
self._marker_choices)
+ self.marker_choice.SetToolTipString ("Select plotting with lines,
pluses or dots")
+ wx.EVT_CHOICE (parent, 1002, self.marker_choice_event)
+ ctrlbox.Add (self.marker_choice, 0, wx.ALIGN_CENTER)
+
+ self.xy_choice = wx.Choice (parent, 1003, choices = ['X:t', 'X:Y'])
+ self.xy_choice.SetToolTipString ("Select X vs time or X vs Y display")
+ wx.EVT_CHOICE (parent, 1003, self.xy_choice_event)
+ ctrlbox.Add (self.xy_choice, 0, wx.ALIGN_CENTER)
+
+ return ctrlbox
+
+ _marker_choices = ['line', 'plus', 'dot']
+
+ def update_timebase_label (self):
+ time_per_div = self.info.get_time_per_div ()
+ s = ' ' + eng_notation.num_to_str (time_per_div) + 's/div'
+ self.time_base_label.SetLabel (s)
+ def decr_timebase (self, evt):
+ self.info.time_scale_cursor.prev ()
+ self.update_timebase_label ()
+
+ def incr_timebase (self, evt):
+ self.info.time_scale_cursor.next ()
+ self.update_timebase_label ()
+
+ def update_v_scale_label (self):
+ volts_per_div = self.info.get_volts_per_div ()
+ s = ' ' + eng_notation.num_to_str (volts_per_div) + '/div' # Not V/div
+ self.v_scale_label.SetLabel (s)
+
+ def decr_v_scale (self, evt):
+ self.info.v_scale_cursor.prev ()
+ self.update_v_scale_label ()
+
+ def incr_v_scale (self, evt):
+ self.info.v_scale_cursor.next ()
+ self.update_v_scale_label ()
+
+ def marker_choice_event (self, evt):
+ s = evt.GetString ()
+ self.set_marker (s)
+
+ def set_autorange(self, on):
+ if on:
+ self.v_scale_label.SetLabel(" (auto)")
+ self.info.autorange = True
+ self.autorange_checkbox.SetValue(True)
+ self.inc_v_button.Enable(False)
+ self.dec_v_button.Enable(False)
+ else:
+ if self.graph.y_range:
+ (l,u) = self.graph.y_range # found by autorange
+ self.info.v_scale_cursor.set_index_by_value((u-l)/8.0)
+ self.update_v_scale_label()
+ self.info.autorange = False
+ self.autorange_checkbox.SetValue(False)
+ self.inc_v_button.Enable(True)
+ self.dec_v_button.Enable(True)
+
+ def autorange_checkbox_event(self, evt):
+ if evt.Checked():
+ self.set_autorange(True)
+ else:
+ self.set_autorange(False)
+
+ def set_marker (self, s):
+ self.info.set_marker (s) # set info for drawing routines
+ i = self.marker_choice.FindString (s)
+ assert i >= 0, "Hmmm, set_marker problem"
+ self.marker_choice.SetSelection (i)
+
+ def set_format_line (self):
+ self.set_marker ('line')
+
+ def set_format_dot (self):
+ self.set_marker ('dot')
+
+ def set_format_plus (self):
+ self.set_marker ('plus')
+
+ def xy_choice_event (self, evt):
+ s = evt.GetString ()
+ self.info.xy = s == 'X:Y'
+
+ def trig_chan_choice_event (self, evt):
+ s = evt.GetString ()
+ ch = int (s[-1]) - 1
+ self.info.scopesink.set_trigger_channel (ch)
+
+ def trig_mode_choice_event (self, evt):
+ sink = self.info.scopesink
+ s = evt.GetString ()
+ if s == 'Pos':
+ sink.set_trigger_mode (gr.gr_TRIG_POS_SLOPE)
+ elif s == 'Neg':
+ sink.set_trigger_mode (gr.gr_TRIG_NEG_SLOPE)
+ elif s == 'Auto':
+ sink.set_trigger_mode (gr.gr_TRIG_AUTO)
+ else:
+ assert 0, "Bad trig_mode_choice string"
+
+ def set_trig_level50 (self, evt):
+ self.info.scopesink.set_trigger_level_auto ()
+
+ def run_stop (self, evt):
+ self.info.running = not self.info.running
+
def set_sample_rate(self, sample_rate):
- self.guts.set_sample_rate(sample_rate)
- self.win.info.set_sample_rate(sample_rate)
+ self.guts.set_sample_rate (sample_rate)
+ self.win.info.set_sample_rate (sample_rate)
+class scope_sink_f (scope_sink_base):
+ def __init__(self, fg, parent, title="", sample_rate=1,
+ size=default_scopesink_size, frame_decim=default_frame_decim,
+ v_scale=default_v_scale, t_scale=None, vbox=None):
+
+ scope_sink_base.__init__(self, fg, parent, title, sample_rate, size,
+ frame_decim, v_scale, t_scale, vbox, False)
+
+class scope_sink_c (scope_sink_base):
+ def __init__(self, fg, parent, title="", sample_rate=1,
+ size=default_scopesink_size, frame_decim=default_frame_decim,
+ v_scale=default_v_scale, t_scale=None, vbox=None):
+
+ scope_sink_base.__init__(self, fg, parent, title, sample_rate, size,
+ frame_decim, v_scale, t_scale, vbox, True)
+
# ========================================================================
# This is the deprecated interface, retained for compatibility...
#
@@ -76,7 +285,6 @@
# ========================================================================
-
time_base_list = [ # time / division
1.0e-7, # 100ns / div
2.5e-7,
@@ -139,6 +347,7 @@
class win_info (object):
+
__slots__ = ['msgq', 'sample_rate', 'frame_decim', 'v_scale',
'scopesink', 'title',
'time_scale_cursor', 'v_scale_cursor', 'marker', 'xy',
@@ -228,216 +437,6 @@
# end if iscan == 0
self.iscan -= 1
-
-class scope_window (wx.Panel):
-
- def __init__ (self, info, parent, id = -1,
- pos = wx.DefaultPosition, size = wx.DefaultSize, name = ""):
- wx.Panel.__init__ (self, parent, -1)
- self.info = info
-
- vbox = wx.BoxSizer (wx.VERTICAL)
-
- self.graph = graph_window (info, self, -1)
-
- vbox.Add (self.graph, 1, wx.EXPAND)
- vbox.Add (self.make_control_box(), 0, wx.EXPAND)
- vbox.Add (self.make_control2_box(), 0, wx.EXPAND)
-
- self.sizer = vbox
- self.SetSizer (self.sizer)
- self.SetAutoLayout (True)
- self.sizer.Fit (self)
- self.set_autorange(self.info.autorange)
-
-
- # second row of control buttons etc. appears BELOW control_box
- def make_control2_box (self):
- ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
-
- self.inc_v_button = wx.Button (self, 1101, " < ", style=wx.BU_EXACTFIT)
- self.inc_v_button.SetToolTipString ("Increase vertical range")
- wx.EVT_BUTTON (self, 1101, self.incr_v_scale) # ID matches button ID
above
-
- self.dec_v_button = wx.Button (self, 1100, " > ",
style=wx.BU_EXACTFIT)
- self.dec_v_button.SetToolTipString ("Decrease vertical range")
- wx.EVT_BUTTON (self, 1100, self.decr_v_scale)
-
- self.v_scale_label = wx.StaticText (self, 1002, "None") # vertical /div
- self.update_v_scale_label ()
-
- self.autorange_checkbox = wx.CheckBox (self, 1102, "Autorange")
- self.autorange_checkbox.SetToolTipString ("Select autorange on/off")
- wx.EVT_CHECKBOX(self, 1102, self.autorange_checkbox_event)
-
- ctrlbox.Add ((5,0) ,0) # left margin space
- ctrlbox.Add (self.inc_v_button, 0, wx.EXPAND)
- ctrlbox.Add (self.dec_v_button, 0, wx.EXPAND)
- ctrlbox.Add (self.v_scale_label, 0, wx.ALIGN_CENTER)
- ctrlbox.Add ((20,0) ,0) # spacer
- ctrlbox.Add (self.autorange_checkbox, 0, wx.ALIGN_CENTER)
-
- return ctrlbox
-
- def make_control_box (self):
- ctrlbox = wx.BoxSizer (wx.HORIZONTAL)
-
- tb_left = wx.Button (self, 1001, " < ", style=wx.BU_EXACTFIT)
- tb_left.SetToolTipString ("Increase time base")
- wx.EVT_BUTTON (self, 1001, self.incr_timebase)
-
-
- tb_right = wx.Button (self, 1000, " > ", style=wx.BU_EXACTFIT)
- tb_right.SetToolTipString ("Decrease time base")
- wx.EVT_BUTTON (self, 1000, self.decr_timebase)
-
- self.time_base_label = wx.StaticText (self, 1002, "")
- self.update_timebase_label ()
-
- ctrlbox.Add ((5,0) ,0)
- # ctrlbox.Add (wx.StaticText (self, -1, "Horiz Scale: "), 0,
wx.ALIGN_CENTER)
- ctrlbox.Add (tb_left, 0, wx.EXPAND)
- ctrlbox.Add (tb_right, 0, wx.EXPAND)
- ctrlbox.Add (self.time_base_label, 0, wx.ALIGN_CENTER)
-
- ctrlbox.Add ((10,0) ,1) # stretchy space
-
- ctrlbox.Add (wx.StaticText (self, -1, "Trig: "), 0, wx.ALIGN_CENTER)
- self.trig_chan_choice = wx.Choice (self, 1004,
- choices = ['Ch1', 'Ch2', 'Ch3',
'Ch4'])
- self.trig_chan_choice.SetToolTipString ("Select channel for trigger")
- wx.EVT_CHOICE (self, 1004, self.trig_chan_choice_event)
- ctrlbox.Add (self.trig_chan_choice, 0, wx.ALIGN_CENTER)
-
- self.trig_mode_choice = wx.Choice (self, 1005,
- choices = ['Auto', 'Pos', 'Neg'])
- self.trig_mode_choice.SetToolTipString ("Select trigger slope or Auto
(untriggered roll)")
- wx.EVT_CHOICE (self, 1005, self.trig_mode_choice_event)
- ctrlbox.Add (self.trig_mode_choice, 0, wx.ALIGN_CENTER)
-
- trig_level50 = wx.Button (self, 1006, "50%")
- trig_level50.SetToolTipString ("Set trigger level to 50%")
- wx.EVT_BUTTON (self, 1006, self.set_trig_level50)
- ctrlbox.Add (trig_level50, 0, wx.EXPAND)
-
- run_stop = wx.Button (self, 1007, "Run/Stop")
- run_stop.SetToolTipString ("Toggle Run/Stop mode")
- wx.EVT_BUTTON (self, 1007, self.run_stop)
- ctrlbox.Add (run_stop, 0, wx.EXPAND)
-
- ctrlbox.Add ((10, 0) ,1) # stretchy space
-
- ctrlbox.Add (wx.StaticText (self, -1, "Fmt: "), 0, wx.ALIGN_CENTER)
- self.marker_choice = wx.Choice (self, 1002, choices =
self._marker_choices)
- self.marker_choice.SetToolTipString ("Select plotting with lines,
pluses or dots")
- wx.EVT_CHOICE (self, 1002, self.marker_choice_event)
- ctrlbox.Add (self.marker_choice, 0, wx.ALIGN_CENTER)
-
- self.xy_choice = wx.Choice (self, 1003, choices = ['X:t', 'X:Y'])
- self.xy_choice.SetToolTipString ("Select X vs time or X vs Y display")
- wx.EVT_CHOICE (self, 1003, self.xy_choice_event)
- ctrlbox.Add (self.xy_choice, 0, wx.ALIGN_CENTER)
-
- return ctrlbox
-
- _marker_choices = ['line', 'plus', 'dot']
-
- def update_timebase_label (self):
- time_per_div = self.info.get_time_per_div ()
- s = ' ' + eng_notation.num_to_str (time_per_div) + 's/div'
- self.time_base_label.SetLabel (s)
-
- def decr_timebase (self, evt):
- self.info.time_scale_cursor.prev ()
- self.update_timebase_label ()
-
- def incr_timebase (self, evt):
- self.info.time_scale_cursor.next ()
- self.update_timebase_label ()
-
- def update_v_scale_label (self):
- volts_per_div = self.info.get_volts_per_div ()
- s = ' ' + eng_notation.num_to_str (volts_per_div) + '/div' # Not V/div
- self.v_scale_label.SetLabel (s)
-
- def decr_v_scale (self, evt):
- self.info.v_scale_cursor.prev ()
- self.update_v_scale_label ()
-
- def incr_v_scale (self, evt):
- self.info.v_scale_cursor.next ()
- self.update_v_scale_label ()
-
- def marker_choice_event (self, evt):
- s = evt.GetString ()
- self.set_marker (s)
-
- def set_autorange(self, on):
- if on:
- self.v_scale_label.SetLabel(" (auto)")
- self.info.autorange = True
- self.autorange_checkbox.SetValue(True)
- self.inc_v_button.Enable(False)
- self.dec_v_button.Enable(False)
- else:
- if self.graph.y_range:
- (l,u) = self.graph.y_range # found by autorange
- self.info.v_scale_cursor.set_index_by_value((u-l)/8.0)
- self.update_v_scale_label()
- self.info.autorange = False
- self.autorange_checkbox.SetValue(False)
- self.inc_v_button.Enable(True)
- self.dec_v_button.Enable(True)
-
- def autorange_checkbox_event(self, evt):
- if evt.Checked():
- self.set_autorange(True)
- else:
- self.set_autorange(False)
-
- def set_marker (self, s):
- self.info.set_marker (s) # set info for drawing routines
- i = self.marker_choice.FindString (s)
- assert i >= 0, "Hmmm, set_marker problem"
- self.marker_choice.SetSelection (i)
-
- def set_format_line (self):
- self.set_marker ('line')
-
- def set_format_dot (self):
- self.set_marker ('dot')
-
- def set_format_plus (self):
- self.set_marker ('plus')
-
- def xy_choice_event (self, evt):
- s = evt.GetString ()
- self.info.xy = s == 'X:Y'
-
- def trig_chan_choice_event (self, evt):
- s = evt.GetString ()
- ch = int (s[-1]) - 1
- self.info.scopesink.set_trigger_channel (ch)
-
- def trig_mode_choice_event (self, evt):
- sink = self.info.scopesink
- s = evt.GetString ()
- if s == 'Pos':
- sink.set_trigger_mode (gr.gr_TRIG_POS_SLOPE)
- elif s == 'Neg':
- sink.set_trigger_mode (gr.gr_TRIG_NEG_SLOPE)
- elif s == 'Auto':
- sink.set_trigger_mode (gr.gr_TRIG_AUTO)
- else:
- assert 0, "Bad trig_mode_choice string"
-
- def set_trig_level50 (self, evt):
- self.info.scopesink.set_trigger_level_auto ()
-
- def run_stop (self, evt):
- self.info.running = not self.info.running
-
-
class graph_window (plot.PlotCanvas):
channel_colors = ['BLUE', 'RED',
@@ -530,7 +529,6 @@
self.Draw (graphics, xAxis=x_range, yAxis=self.y_range)
self.update_y_range () # autorange to self.y_range
-
def format_xy_data (self, evt):
info = self.info
records = evt.data
@@ -565,7 +563,6 @@
self.update_y_range ()
self.update_x_range ()
-
def update_y_range (self):
alpha = 1.0/25
graphics = self.last_draw[0]
@@ -582,7 +579,6 @@
# print "p1 %s p2 %s y_min %s y_max %s y_range %s" \
# % (p1, p2, self.avg_y_min, self.avg_y_max, self.y_range)
-
def update_x_range (self):
alpha = 1.0/25
graphics = self.last_draw[0]
@@ -621,7 +617,8 @@
else:
t_scale = None # old behavior
- print "frame decim %s v_scale %s t_scale %s" %
(frame_decim,v_scale,t_scale)
+ print "frame decim %s v_scale %s t_scale %s" % \
+ (frame_decim,v_scale,t_scale)
input_rate = 1e6
@@ -630,13 +627,18 @@
# We add this throttle block so that this demo doesn't suck down
# all the CPU available. You normally wouldn't use it...
- throttle = gr.throttle(gr.sizeof_gr_complex, input_rate)
- scope = scope_sink_c (self, panel,"Secret Data",sample_rate=input_rate,
- frame_decim=frame_decim,
- v_scale=v_scale, t_scale=t_scale)
- vbox.Add (scope.win, 1, wx.EXPAND)
+ throttle = gr.throttle (gr.sizeof_gr_complex, input_rate)
+ scope = scope_sink_c (fg=self, parent=panel, title="Secret Data",
+ sample_rate=input_rate, frame_decim=frame_decim,
+ v_scale=v_scale, t_scale=t_scale, vbox=vbox)
+
+ # these would be nice for this demo,
+ # but they don't work until the FG is actually running
+# scope.guts.set_trigger_channel (1) # ch1
+# scope.guts.set_trigger_mode (gr.gr_TRIG_NEG_SLOPE)
+
# wire the blocks together
self.connect (src0, throttle, scope)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r4770 - gnuradio/branches/developers/michaelld/scopesink/gr-wxgui/src/python,
michaelld <=