commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8909 - gnuradio/branches/features/experimental-gui


From: jblum
Subject: [Commit-gnuradio] r8909 - gnuradio/branches/features/experimental-gui
Date: Wed, 16 Jul 2008 18:55:56 -0600 (MDT)

Author: jblum
Date: 2008-07-16 18:55:55 -0600 (Wed, 16 Jul 2008)
New Revision: 8909

Added:
   gnuradio/branches/features/experimental-gui/const_window.py
Modified:
   gnuradio/branches/features/experimental-gui/common.py
   gnuradio/branches/features/experimental-gui/constsink.py
   gnuradio/branches/features/experimental-gui/fft_window.py
   gnuradio/branches/features/experimental-gui/fftsink.py
   gnuradio/branches/features/experimental-gui/scopesink.py
   gnuradio/branches/features/experimental-gui/todo.txt
Log:
constellation window and constsink wrapper

Modified: gnuradio/branches/features/experimental-gui/common.py
===================================================================
--- gnuradio/branches/features/experimental-gui/common.py       2008-07-17 
00:21:13 UTC (rev 8908)
+++ gnuradio/branches/features/experimental-gui/common.py       2008-07-17 
00:55:55 UTC (rev 8909)
@@ -25,9 +25,9 @@
 import wx
 
 class prop_setter(object):
-       def _register_set_prop(self, controller, control_key, default):
+       def _register_set_prop(self, controller, control_key, init=None):
                def set_method(value): controller[control_key] = value
-               set_method(default)
+               if init is not None: set_method(init)
                setattr(self, 'set_%s'%control_key, set_method)
 
 ##################################################

Copied: gnuradio/branches/features/experimental-gui/const_window.py (from rev 
8906, gnuradio/branches/features/experimental-gui/constsink.py)
===================================================================
--- gnuradio/branches/features/experimental-gui/const_window.py                 
        (rev 0)
+++ gnuradio/branches/features/experimental-gui/const_window.py 2008-07-17 
00:55:55 UTC (rev 8909)
@@ -0,0 +1,203 @@
+#
+# Copyright 2008 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street,
+# Boston, MA 02110-1301, USA.
+#
+
+##################################################
+# Imports
+##################################################
+import plotter
+import common
+import wx
+import numpy
+import math
+import prop_val
+
+##################################################
+# Constants
+##################################################
+SLIDER_STEPS = 100
+ALPHA_MIN_EXP, ALPHA_MAX_EXP = -6, -0.7
+GAIN_MU_MIN_EXP, GAIN_MU_MAX_EXP = -6, -0.7
+DEFAULT_FRAME_RATE = 30
+DEFAULT_WIN_SIZE = (500, 400)
+DEFAULT_CONST_SIZE = 1024
+CONST_PLOT_COLOR_SPEC = (0, 0, 1)
+MARKER_TYPES = (
+       ('Line', None),
+       ('Plus', '+'),
+       ('Dot', '.'),
+)
+RUNNING_KEY = 'running'
+X_DIVS_KEY = 'x_divs'
+Y_DIVS_KEY = 'y_divs'
+
+##################################################
+# Constellation window control panel
+##################################################
+class control_panel(wx.Panel):
+       """!
+       A control panel with wx widgits to control the plotter.
+       """
+       def __init__(self, parent):
+               """!
+               Create a new control panel.
+               @param parent the wx parent window
+               """
+               self.parent = parent
+               wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
+               control_box = wx.BoxSizer(wx.VERTICAL)
+               self.marker_index = 2
+               #begin control box
+               control_box.AddStretchSpacer()
+               control_box.Add(common.LabelText(self, 'Options'), 0, 
wx.ALIGN_CENTER)
+               #marker
+               control_box.AddStretchSpacer()
+               hbox = wx.BoxSizer(wx.HORIZONTAL)
+               control_box.Add(hbox, 0, wx.EXPAND)
+               hbox.Add(wx.StaticText(self, -1, ' Marker '), 1, 
wx.ALIGN_CENTER_VERTICAL)
+               self.marker_chooser = wx.Choice(self, -1, choices=[m[0] for m 
in MARKER_TYPES])
+               self.marker_chooser.Bind(wx.EVT_CHOICE, self._on_marker)
+               hbox.Add(self.marker_chooser, 0, wx.ALIGN_CENTER_VERTICAL)
+               #alpha
+               control_box.AddStretchSpacer()
+               self.alpha_slider = common.LogSliderController(
+                       self, 'Alpha',
+                       ALPHA_MIN_EXP, ALPHA_MAX_EXP, SLIDER_STEPS,
+                       parent.ext_controller, parent.alpha_key,
+               )
+               control_box.Add(self.alpha_slider, 0, wx.EXPAND)
+               #gain_mu
+               control_box.AddStretchSpacer()
+               self.gain_mu_slider = common.LogSliderController(
+                       self, 'Gain Mu',
+                       GAIN_MU_MIN_EXP, GAIN_MU_MAX_EXP, SLIDER_STEPS,
+                       parent.ext_controller, parent.gain_mu_key,
+               )
+               control_box.Add(self.gain_mu_slider, 0, wx.EXPAND)
+               #run/stop
+               control_box.AddStretchSpacer()
+               self.run_button = common.RunStopButtonController(self, 
parent.controller, RUNNING_KEY)
+               control_box.Add(self.run_button, 0, wx.EXPAND)
+               #set sizer
+               self.SetSizerAndFit(control_box)
+               self.update()
+               
+       def update(self, *args):
+               self.marker_chooser.SetSelection(self.marker_index)
+               self.parent.marker = MARKER_TYPES[self.marker_index][1]
+
+       ##################################################
+       # Event handlers
+       ##################################################
+       def _on_marker(self, event):
+               self.marker_index = self.marker_chooser.GetSelection()
+               self.update()
+
+##################################################
+# Constellation window with plotter and control panel
+##################################################
+class const_window(wx.Panel, common.prop_setter):
+       def __init__(
+               self,
+               parent,
+               controller,
+               size,
+               title,
+               msg_key,
+               alpha_key,
+               beta_key,
+               gain_mu_key,
+               gain_omega_key,
+       ):
+               self.controller = prop_val.prop_val_interface()
+               #setup
+               self.ext_controller = controller
+               self.alpha_key = alpha_key
+               self.beta_key = beta_key
+               self.gain_mu_key = gain_mu_key
+               self.gain_omega_key = gain_omega_key
+               #init panel and plot
+               wx.Panel.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
+               self.plotter = plotter.grid_plotter(self)
+               self.plotter.SetSize(wx.Size(*size))
+               self.plotter.set_title(title)
+               self.plotter.set_x_units('Inphase')
+               self.plotter.set_y_units('Quadrature')
+               #setup the box with plot and controls
+               self.control_panel = control_panel(self)
+               main_box = wx.BoxSizer(wx.HORIZONTAL)
+               main_box.Add(self.plotter, 1, wx.EXPAND)
+               main_box.Add(self.control_panel, 0, wx.EXPAND)
+               self.SetSizerAndFit(main_box)
+               #alpha and gain mu 2nd orders
+               def set_beta(alpha): self.ext_controller[self.beta_key] = 
.25*alpha**2
+               self.ext_controller.add_listener(self.alpha_key, set_beta)
+               def set_gain_omega(gain_mu): 
self.ext_controller[self.gain_omega_key] = .25*gain_mu**2
+               self.ext_controller.add_listener(self.gain_mu_key, 
set_gain_omega)
+               #initial setup
+               self.ext_controller[self.alpha_key] = 
self.ext_controller[self.alpha_key]
+               self.ext_controller[self.gain_mu_key] = 
self.ext_controller[self.gain_mu_key]
+               self._register_set_prop(self.controller, RUNNING_KEY, True)
+               self._register_set_prop(self.controller, X_DIVS_KEY, 8)
+               self._register_set_prop(self.controller, Y_DIVS_KEY, 8)
+               #register events
+               self.ext_controller.add_listener(msg_key, self.handle_msg)
+               for key in (
+                       X_DIVS_KEY, Y_DIVS_KEY,
+               ): self.controller.add_listener(key, self.update_grid)
+               #initial update
+               self.update_grid()
+
+       def handle_msg(self, msg):
+               """!
+               Plot the samples onto the complex grid.
+               @param msg the array of complex samples
+               """
+               if not self.controller[RUNNING_KEY]: return
+               #convert to complex floating point numbers
+               samples = numpy.fromstring(msg, numpy.complex64)
+               real = numpy.real(samples)
+               imag = numpy.imag(samples)
+               #plot
+               self.plotter.set_waveform(
+                       channel=0,
+                       samples=(real, imag),
+                       color_spec=CONST_PLOT_COLOR_SPEC,
+                       marker=self.marker,
+               )
+               #update the plotter
+               self.plotter.update()
+
+       def update_grid(self):
+               #grid parameters
+               x_divs = self.controller[X_DIVS_KEY]
+               y_divs = self.controller[Y_DIVS_KEY]
+               #update the x axis
+               x_max = 1.2
+               self.plotter.set_x_grid(-x_max, x_max, 
common.get_clean_num(2.0*x_max/x_divs))
+               #update the y axis
+               y_max = 1.2
+               self.plotter.set_y_grid(-y_max, y_max, 
common.get_clean_num(2.0*y_max/y_divs))
+               #update plotter
+               self.plotter.update()
+
+
+
+

Modified: gnuradio/branches/features/experimental-gui/constsink.py
===================================================================
--- gnuradio/branches/features/experimental-gui/constsink.py    2008-07-17 
00:21:13 UTC (rev 8908)
+++ gnuradio/branches/features/experimental-gui/constsink.py    2008-07-17 
00:55:55 UTC (rev 8909)
@@ -22,194 +22,27 @@
 ##################################################
 # Imports
 ##################################################
-from gnuradio import gr, blks2
-import plotter
+import const_window
 import common
-import wx
-import numpy
-import math
+from gnuradio import gr, blks2
+from prop_val import prop_val_interface
 
 ##################################################
 # Constants
 ##################################################
-SLIDER_STEPS = 100
-ALPHA_SLIDER_MIN, ALPHA_SLIDER_MAX = -6, -0.7
-GAIN_MU_SLIDER_MIN, GAIN_MU_SLIDER_MAX = -6, -0.7
-DEFAULT_FRAME_RATE = 30
-DEFAULT_WIN_SIZE = (500, 400)
-DEFAULT_CONST_SIZE = 1024
-CONST_PLOT_COLOR_SPEC = (0, 0, 1)
-MARKER_TYPES = (
-       ('Line', None),
-       ('Plus', '+'),
-       ('Dot', '.'),
-)
+SAMPLE_RATE_KEY = 'sample_rate'
+ALPHA_KEY = 'alpha'
+BETA_KEY = 'beta'
+GAIN_MU_KEY = 'gain_mu'
+OMEGA_KEY = 'omega'
+GAIN_OMEGA_KEY = 'gain_omega'
+MSG_KEY = 'msg'
 
 ##################################################
-# Constellation window control panel
+# Constellation sink block (wrapper for old wxgui)
 ##################################################
-class control_panel(wx.Panel):
+class const_sink_c(gr.hier_block2, common.prop_setter):
        """!
-       A control panel with wx widgits to control the plotter.
-       """
-       def __init__(self, parent):
-               """!
-               Create a new control panel.
-               @param parent the wx parent window
-               """
-               self.parent = parent
-               wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
-               control_box = wx.BoxSizer(wx.VERTICAL)
-
-               #begin control box
-               control_box.AddStretchSpacer()
-               control_box.Add(common.LabelText(self, 'Options'), 0, 
wx.ALIGN_CENTER)
-               control_box.AddSpacer(2)
-               #alpha
-               control_box.AddStretchSpacer()
-               self.alpha_label = wx.StaticText(self, -1, '')
-               control_box.Add(self.alpha_label, 0, wx.EXPAND)
-               self.alpha_slider = wx.Slider(self, -1, 0, 0, SLIDER_STEPS, 
style=wx.SL_HORIZONTAL)
-               self.alpha_slider.Bind(wx.EVT_SLIDER, self._on_alpha)
-               control_box.Add(self.alpha_slider, 0, wx.EXPAND)
-               #gain_mu
-               control_box.AddStretchSpacer()
-               self.gain_mu_label = wx.StaticText(self, -1, '0'*15)
-               control_box.Add(self.gain_mu_label, 0, wx.EXPAND)
-               self.gain_mu_slider = wx.Slider(self, -1, 0, 0, SLIDER_STEPS, 
style=wx.SL_HORIZONTAL)
-               self.gain_mu_slider.Bind(wx.EVT_SLIDER, self._on_gain_mu)
-               control_box.Add(self.gain_mu_slider, 0, wx.EXPAND)
-               #run/stop
-               control_box.AddStretchSpacer()
-               self.run_button = wx.Button(self, -1, '', style=wx.BU_EXACTFIT)
-               self.run_button.Bind(wx.EVT_BUTTON, self._on_run)
-               control_box.Add(self.run_button, 0, wx.EXPAND)
-
-               #set sizer
-               self.SetSizerAndFit(control_box)
-               #update
-               self.update()
-
-       def update(self):
-               #update mpsk params
-               self.alpha_label.SetLabel('Alpha: %.3g'%self.parent.alpha)
-               slider_value = 
SLIDER_STEPS*(math.log10(self.parent.alpha)-ALPHA_SLIDER_MIN)/(ALPHA_SLIDER_MAX-ALPHA_SLIDER_MIN)
-               if abs(slider_value - self.alpha_slider.GetValue())  > 1:
-                       self.alpha_slider.SetValue(slider_value)
-               self.gain_mu_label.SetLabel('Gain Mu: %.3g'%self.parent.gain_mu)
-               slider_value = 
SLIDER_STEPS*(math.log10(self.parent.gain_mu)-GAIN_MU_SLIDER_MIN)/(GAIN_MU_SLIDER_MAX-GAIN_MU_SLIDER_MIN)
-               if abs(slider_value - self.gain_mu_slider.GetValue())  > 1:
-                       self.gain_mu_slider.SetValue(slider_value)
-               #update the run/stop button
-               if self.parent.running: self.run_button.SetLabel('Stop')
-               else: self.run_button.SetLabel('Run')
-
-       ##################################################
-       # Event handlers
-       ##################################################
-       def _on_run(self, event): self.parent.set_run(not self.parent.running)
-       def _on_alpha(self, event):
-               
self.parent.set_alpha(10**(float(ALPHA_SLIDER_MAX-ALPHA_SLIDER_MIN)*self.alpha_slider.GetValue()/SLIDER_STEPS
 + ALPHA_SLIDER_MIN))
-       def _on_gain_mu(self, event):
-               
self.parent.set_gain_mu(10**(float(GAIN_MU_SLIDER_MAX-GAIN_MU_SLIDER_MIN)*self.gain_mu_slider.GetValue()/SLIDER_STEPS
 + GAIN_MU_SLIDER_MIN))
-
-##################################################
-# Constellation window with plotter and control panel
-##################################################
-class const_window(wx.Panel):
-       def __init__(
-               self,
-               parent,
-               size,
-               title,
-               alpha,
-               gain_mu,
-               #callbacks to mpsk recv
-               ext_set_alpha,
-               ext_set_beta,
-               ext_set_gain_mu,
-               ext_set_gain_omega,
-       ):
-               #setup
-               self.running = True
-               self.x_divs = 8
-               self.y_divs = 8
-               #mspk settings
-               self.alpha = alpha
-               self.gain_mu = gain_mu
-               #callbacks to mpsk recv
-               self.ext_set_alpha = ext_set_alpha
-               self.ext_set_beta = ext_set_beta
-               self.ext_set_gain_mu = ext_set_gain_mu
-               self.ext_set_gain_omega = ext_set_gain_omega
-               #init panel and plot
-               wx.Panel.__init__(self, parent, -1, style=wx.SIMPLE_BORDER)
-               self.plotter = plotter.grid_plotter(self)
-               self.plotter.SetSize(wx.Size(*size))
-               self.plotter.set_title(title)
-               self.plotter.set_x_units('Inphase')
-               self.plotter.set_y_units('Quadrature')
-               #setup the box with plot and controls
-               self.control_panel = control_panel(self)
-               main_box = wx.BoxSizer(wx.HORIZONTAL)
-               main_box.Add(self.plotter, 1, wx.EXPAND)
-               main_box.Add(self.control_panel, 0, wx.EXPAND)
-               self.SetSizerAndFit(main_box)
-               #update
-               self.update()
-
-       def plot(self, samples):
-               """!
-               Plot the samples onto the complex grid.
-               @param samples the array of complex samples
-               """
-               if not self.running: return
-               real = numpy.real(samples)
-               imag = numpy.imag(samples)
-               #plot
-               self.plotter.set_waveform(
-                       channel=0,
-                       samples=(real, imag),
-                       color_spec=CONST_PLOT_COLOR_SPEC,
-                       marker='.',
-               )
-               #update the plotter
-               self.plotter.update()
-
-       def update(self):
-               #update mpsk
-               self.ext_set_alpha(self.alpha)
-               self.ext_set_beta(.25*self.alpha**2)
-               self.ext_set_gain_mu(self.gain_mu)
-               self.ext_set_gain_omega(.25*self.gain_mu**2)
-               #update the x axis
-               x_max = 1.2
-               self.plotter.set_x_grid(-x_max, x_max, 
common.get_clean_num(2.0*x_max/self.x_divs))
-               #update the y axis
-               y_max = 1.2
-               self.plotter.set_y_grid(-y_max, y_max, 
common.get_clean_num(2.0*y_max/self.y_divs))
-               #update control panel and plotter
-               self.control_panel.update()
-               self.plotter.update()
-
-       ##################################################
-       # Set parameters on-the-fly
-       ##################################################
-       def set_alpha(self, alpha):
-               self.alpha = alpha
-               self.update()
-       def set_gain_mu(self, gain_mu):
-               self.gain_mu = gain_mu
-               self.update()
-       def set_run(self, running):
-               self.running = running
-               self.update()
-
-##################################################
-# Constellation sink block
-##################################################
-class const_sink_c(gr.hier_block2):
-       """!
        A constellation block with a gui window.
        """
 
@@ -218,9 +51,9 @@
                parent,
                title='',
                sample_rate=1,
-               size=DEFAULT_WIN_SIZE,
-               frame_rate=DEFAULT_FRAME_RATE,
-               const_size=DEFAULT_CONST_SIZE,
+               size=const_window.DEFAULT_WIN_SIZE,
+               frame_rate=const_window.DEFAULT_FRAME_RATE,
+               const_size=const_window.DEFAULT_CONST_SIZE,
                #mpsk recv params
                M=4,
                theta=0,
@@ -231,7 +64,6 @@
                symbol_rate=1,
                omega_limit=0.005,
        ):
-               self.const_size = const_size
                #init
                gr.hier_block2.__init__(
                        self,
@@ -240,7 +72,7 @@
                        gr.io_signature(0, 0, 0),
                )
                #blocks
-               self.sd = blks2.stream_to_vector_decimator(
+               sd = blks2.stream_to_vector_decimator(
                        item_size=gr.sizeof_gr_complex,
                        sample_rate=sample_rate,
                        vec_rate=frame_rate,
@@ -250,8 +82,7 @@
                fmin = -fmax
                gain_omega = .25*gain_mu**2 #redundant, will be updated
                omega = 1 #set_sample_rate will update this
-               self.symbol_rate = symbol_rate
-               self.sync = gr.mpsk_receiver_cc(
+               sync = gr.mpsk_receiver_cc(
                        M, #psk order
                        theta,
                        alpha,
@@ -268,34 +99,44 @@
                msgq = gr.msg_queue(2)
                sink = gr.message_sink(gr.sizeof_gr_complex*const_size, msgq, 
True)
                #connect
-               self.connect(self, self.sync, agc, self.sd, sink)
+               self.connect(self, sync, agc, sd, sink)
+               #controller
+               self.controller = prop_val_interface()
+               self.controller.add_listener(ALPHA_KEY, sync.set_alpha)
+               self.controller.set_provider(ALPHA_KEY, sync.alpha)
+               self.controller.add_listener(BETA_KEY, sync.set_beta)
+               self.controller.set_provider(BETA_KEY, sync.beta)
+               self.controller.add_listener(GAIN_MU_KEY, sync.set_gain_mu)
+               self.controller.set_provider(GAIN_MU_KEY, sync.gain_mu)
+               self.controller.add_listener(OMEGA_KEY, sync.set_omega)
+               self.controller.set_provider(OMEGA_KEY, sync.omega)
+               self.controller.add_listener(GAIN_OMEGA_KEY, 
sync.set_gain_omega)
+               self.controller.set_provider(GAIN_OMEGA_KEY, sync.gain_omega)
+               self.controller.add_listener(SAMPLE_RATE_KEY, 
sd.set_sample_rate)
+               self.controller.add_listener(SAMPLE_RATE_KEY, lambda x: 
self.controller.set(OMEGA_KEY, float(x)/symbol_rate))
+               self.controller.set_provider(SAMPLE_RATE_KEY, sd.sample_rate)
+               #start input watcher
+               common.input_watcher(msgq, lambda x: 
self.controller.set(MSG_KEY, x))
                #create window
-               self.win = const_window(
+               self.win = const_window.const_window(
                        parent=parent,
+                       controller=self.controller,
                        size=size,
                        title=title,
-                       alpha=alpha,
-                       gain_mu=gain_mu,
-                       #callbacks to mpsk recv
-                       ext_set_alpha=self.sync.set_alpha,
-                       ext_set_beta=self.sync.set_beta,
-                       ext_set_gain_mu=self.sync.set_gain_mu,
-                       ext_set_gain_omega=self.sync.set_gain_omega,
+                       msg_key=MSG_KEY,
+                       alpha_key=ALPHA_KEY,
+                       beta_key=BETA_KEY,
+                       gain_mu_key=GAIN_MU_KEY,
+                       gain_omega_key=GAIN_OMEGA_KEY,
                )
                #register callbacks from window for external use
-               
-               #setup the input watcher
-               common.input_watcher(msgq, self._handle_msg)
-               #update
-               self.set_sample_rate(sample_rate)
-               
-       def set_sample_rate(self, sample_rate):
-               self.sample_rate = sample_rate
-               self.omega = float(self.sample_rate)/self.symbol_rate
-               self.sd.set_sample_rate(self.sample_rate)
-               self.sync.set_omega(self.omega)
+               for attr in filter(lambda a: a.startswith('set_'), 
dir(self.win)):
+                       setattr(self, attr, getattr(self.win, attr))
+               self._register_set_prop(self.controller, ALPHA_KEY)
+               self._register_set_prop(self.controller, BETA_KEY)
+               self._register_set_prop(self.controller, GAIN_MU_KEY)
+               self._register_set_prop(self.controller, OMEGA_KEY)
+               self._register_set_prop(self.controller, GAIN_OMEGA_KEY)
+               self._register_set_prop(self.controller, SAMPLE_RATE_KEY)
 
-       def _handle_msg(self, msg):
-               #convert to complex floating point numbers
-               samples = numpy.fromstring(msg, 
numpy.complex64)[:self.const_size] #only take first frame
-               self.win.plot(samples)
+

Modified: gnuradio/branches/features/experimental-gui/fft_window.py
===================================================================
--- gnuradio/branches/features/experimental-gui/fft_window.py   2008-07-17 
00:21:13 UTC (rev 8908)
+++ gnuradio/branches/features/experimental-gui/fft_window.py   2008-07-17 
00:55:55 UTC (rev 8909)
@@ -64,7 +64,6 @@
                self.parent = parent
                wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
                control_box = wx.BoxSizer(wx.VERTICAL)
-
                #checkboxes for average and peak hold
                control_box.AddStretchSpacer()
                control_box.Add(common.LabelText(self, 'Options'), 0, 
wx.ALIGN_CENTER)
@@ -80,7 +79,6 @@
                )
                parent.ext_controller.add_listener(parent.average_key, 
self.avg_alpha_slider.Enable)
                control_box.Add(self.avg_alpha_slider, 0, wx.EXPAND)
-
                #radio buttons for div size
                control_box.AddStretchSpacer()
                control_box.Add(common.LabelText(self, 'Set dB/div'), 0, 
wx.ALIGN_CENTER)
@@ -93,19 +91,16 @@
                        radio_box.Add(radio_button, 0, wx.ALIGN_LEFT)
                parent.controller.add_listener(Y_PER_DIV_KEY, 
self._on_set_y_per_div)
                control_box.Add(radio_box, 0, wx.EXPAND)
-
                #ref lvl buttons
                control_box.AddStretchSpacer()
                control_box.Add(common.LabelText(self, 'Set Ref Level'), 0, 
wx.ALIGN_CENTER)
                control_box.AddSpacer(2)
                self._ref_lvl_buttons = common.IncrDecrButtons(self, 
self._on_incr_ref_level, self._on_decr_ref_level)
                control_box.Add(self._ref_lvl_buttons, 0, wx.ALIGN_CENTER)
-
                #run/stop
                control_box.AddStretchSpacer()
                self.run_button = common.RunStopButtonController(self, 
parent.controller, RUNNING_KEY)
                control_box.Add(self.run_button, 0, wx.EXPAND)
-
                #set sizer
                self.SetSizerAndFit(control_box)
 

Modified: gnuradio/branches/features/experimental-gui/fftsink.py
===================================================================
--- gnuradio/branches/features/experimental-gui/fftsink.py      2008-07-17 
00:21:13 UTC (rev 8908)
+++ gnuradio/branches/features/experimental-gui/fftsink.py      2008-07-17 
00:55:55 UTC (rev 8909)
@@ -38,7 +38,7 @@
 ##################################################
 # FFT sink block (wrapper for old wxgui)
 ##################################################
-class _fft_sink_base(gr.hier_block2):
+class _fft_sink_base(gr.hier_block2, common.prop_setter):
        """!
        An fft block with real/complex inputs and a gui window.
        """
@@ -114,14 +114,10 @@
                #register callbacks from window for external use
                for attr in filter(lambda a: a.startswith('set_'), 
dir(self.win)):
                        setattr(self, attr, getattr(self.win, attr))
+               self._register_set_prop(self.controller, SAMPLE_RATE_KEY)
+               self._register_set_prop(self.controller, AVERAGE_KEY)
+               self._register_set_prop(self.controller, AVG_ALPHA_KEY)
 
-       def set_sample_rate(self, sample_rate):
-               self.controller[SAMPLE_RATE_KEY] = sample_rate
-       def set_average(self, average): 
-               self.controller[AVERAGE_KEY] = average
-       def set_avg_alpha(self, avg_alpha): 
-               self.controller[AVG_ALPHA_KEY] = avg_alpha
-
 class fft_sink_f(_fft_sink_base):
        fft_chain = blks2.logpwrfft_f
        item_size = gr.sizeof_float

Modified: gnuradio/branches/features/experimental-gui/scopesink.py
===================================================================
--- gnuradio/branches/features/experimental-gui/scopesink.py    2008-07-17 
00:21:13 UTC (rev 8908)
+++ gnuradio/branches/features/experimental-gui/scopesink.py    2008-07-17 
00:55:55 UTC (rev 8909)
@@ -40,7 +40,7 @@
 ##################################################
 # Scope sink block (wrapper for old wxgui)
 ##################################################
-class scope_sink_f(gr.hier_block2):
+class scope_sink_f(gr.hier_block2, common.prop_setter):
        """!
        A scope block with a gui window.
        """
@@ -110,6 +110,4 @@
                #register callbacks from window for external use
                for attr in filter(lambda a: a.startswith('set_'), 
dir(self.win)):
                        setattr(self, attr, getattr(self.win, attr))
-
-       def set_sample_rate(self, sample_rate):
-               self.controller[SAMPLE_RATE_KEY] = sample_rate
+               self._register_set_prop(self.controller, SAMPLE_RATE_KEY)

Modified: gnuradio/branches/features/experimental-gui/todo.txt
===================================================================
--- gnuradio/branches/features/experimental-gui/todo.txt        2008-07-17 
00:21:13 UTC (rev 8908)
+++ gnuradio/branches/features/experimental-gui/todo.txt        2008-07-17 
00:55:55 UTC (rev 8909)
@@ -6,3 +6,9 @@
 -add/remove listener in cli.py
 -logpwrfft needs sample rate
 -logpwrfft has problem when average=True
+-channel model needs sample rate param
+-constsink: replace mpsk recv with costas + clock recovery
+-costas loop needs set methods
+-2d waterfallsink
+-give numbersink the treatment
+-run expand on all files (sorry tabs)





reply via email to

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