commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10561 - in gnuradio/branches/developers/jblum/gui_gut


From: jblum
Subject: [Commit-gnuradio] r10561 - in gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python: . plotter
Date: Thu, 5 Mar 2009 12:21:46 -0700 (MST)

Author: jblum
Date: 2009-03-05 12:21:45 -0700 (Thu, 05 Mar 2009)
New Revision: 10561

Modified:
   gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/const_window.py
   gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fft_window.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histo_window.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histosink_gl.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/bar_plotter.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/grid_plotter_base.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfall_window.py
Log:
WIP!! Added gui controls in histogram plotter.
Added common text box control with eng notation.
Added common box class with label, cleaned up other windows with.
Improved pop-up label in bar plotter.



Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py
===================================================================
--- gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py   
2009-03-05 01:21:44 UTC (rev 10560)
+++ gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/common.py   
2009-03-05 19:21:45 UTC (rev 10561)
@@ -47,15 +47,6 @@
        for key in controller.keys(): _register_access_method(destination, 
controller, key)
 
 ##################################################
-# Custom Data Event
-##################################################
-EVT_DATA = wx.PyEventBinder(wx.NewEventType())
-class DataEvent(wx.PyEvent):
-       def __init__(self, data):
-               wx.PyEvent.__init__(self, wx.NewId(), EVT_DATA.typeId)
-               self.data = data
-
-##################################################
 # Input Watcher Thread
 ##################################################
 class input_watcher(threading.Thread):
@@ -91,6 +82,12 @@
                font.SetWeight(wx.FONTWEIGHT_BOLD)
                self.SetFont(font)
 
+class LabelBox(wx.BoxSizer):
+       def __init__(self, parent, label, widget):
+               wx.BoxSizer.__init__(self, wx.HORIZONTAL)
+               self.Add(wx.StaticText(parent, label=label), 1, 
wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)
+               self.Add(widget, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT)
+
 class IncrDecrButtons(wx.BoxSizer):
        """
        A horizontal box sizer with a increment and a decrement button.
@@ -140,6 +137,21 @@
        def _evt_checkbox(self, e):
                self._controller[self._control_key] = bool(e.IsChecked())
 
+from gnuradio import eng_notation
+
+class TextBoxController(wx.TextCtrl):
+       def __init__(self, parent, controller, control_key, cast=float):
+               self._controller = controller
+               self._control_key = control_key
+               self._cast = cast
+               wx.TextCtrl.__init__(self, parent, style=wx.TE_PROCESS_ENTER)
+               self.Bind(wx.EVT_TEXT_ENTER, self._evt_enter)
+               controller.subscribe(control_key, lambda x: 
self.SetValue(eng_notation.num_to_str(x)))
+
+       def _evt_enter(self, e):
+               try: self._controller[self._control_key] = 
self._cast(eng_notation.str_to_num(self.GetValue()))
+               except: self._controller[self._control_key] = 
self._controller[self._control_key]
+
 class LogSliderController(wx.BoxSizer):
        """
        Log slider controller with display label and slider.

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/const_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/const_window.py 
    2009-03-05 01:21:44 UTC (rev 10560)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/const_window.py 
    2009-03-05 19:21:45 UTC (rev 10561)
@@ -62,7 +62,7 @@
                @param parent the wx parent window
                """
                self.parent = parent
-               wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
                control_box = wx.BoxSizer(wx.VERTICAL)
                self.marker_index = 2
                #begin control box

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fft_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fft_window.py   
    2009-03-05 01:21:44 UTC (rev 10560)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/fft_window.py   
    2009-03-05 19:21:45 UTC (rev 10561)
@@ -57,31 +57,31 @@
                @param parent the wx parent window
                """
                self.parent = parent
-               wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
+               wx.Panel.__init__(self, parent, 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)
-               self.average_check_box = common.CheckBoxController(self, 
'Average', parent, AVERAGE_KEY)
-               control_box.Add(self.average_check_box, 0, wx.EXPAND)
-               self.peak_hold_check_box = common.CheckBoxController(self, 
'Peak Hold', parent, PEAK_HOLD_KEY)
-               control_box.Add(self.peak_hold_check_box, 0, wx.EXPAND)
+               average_check_box = common.CheckBoxController(self, 'Average', 
parent, AVERAGE_KEY)
+               control_box.Add(average_check_box, 0, wx.EXPAND)
+               peak_hold_check_box = common.CheckBoxController(self, 'Peak 
Hold', parent, PEAK_HOLD_KEY)
+               control_box.Add(peak_hold_check_box, 0, wx.EXPAND)
                control_box.AddSpacer(2)
-               self.avg_alpha_slider = common.LogSliderController(
+               avg_alpha_slider = common.LogSliderController(
                        self, 'Avg Alpha',
                        AVG_ALPHA_MIN_EXP, AVG_ALPHA_MAX_EXP, SLIDER_STEPS,
                        parent, AVG_ALPHA_KEY,
                        formatter=lambda x: ': %.4f'%x,
                )
-               parent.subscribe(AVERAGE_KEY, self.avg_alpha_slider.Enable)
-               control_box.Add(self.avg_alpha_slider, 0, wx.EXPAND)
+               parent.subscribe(AVERAGE_KEY, avg_alpha_slider.Enable)
+               control_box.Add(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)
                radio_box = wx.BoxSizer(wx.VERTICAL)
                self.radio_buttons = list()
                for y_per_div in DIV_LEVELS:
-                       radio_button = wx.RadioButton(self, -1, "%d 
dB/div"%y_per_div)
+                       radio_button = wx.RadioButton(self, label="%d 
dB/div"%y_per_div)
                        radio_button.Bind(wx.EVT_RADIOBUTTON, 
self._on_y_per_div)
                        self.radio_buttons.append(radio_button)
                        radio_box.Add(radio_button, 0, wx.ALIGN_LEFT)
@@ -91,16 +91,16 @@
                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)
+               _ref_lvl_buttons = common.IncrDecrButtons(self, 
self._on_incr_ref_level, self._on_decr_ref_level)
+               control_box.Add(_ref_lvl_buttons, 0, wx.ALIGN_CENTER)
                #autoscale
                control_box.AddStretchSpacer()
-               self.autoscale_button = wx.Button(self, label='Autoscale', 
style=wx.BU_EXACTFIT)
-               self.autoscale_button.Bind(wx.EVT_BUTTON, self.parent.autoscale)
-               control_box.Add(self.autoscale_button, 0, wx.EXPAND)
+               autoscale_button = wx.Button(self, label='Autoscale', 
style=wx.BU_EXACTFIT)
+               autoscale_button.Bind(wx.EVT_BUTTON, self.parent.autoscale)
+               control_box.Add(autoscale_button, 0, wx.EXPAND)
                #run/stop
-               self.run_button = common.ToggleButtonController(self, parent, 
RUNNING_KEY, 'Stop', 'Run')
-               control_box.Add(self.run_button, 0, wx.EXPAND)
+               run_button = common.ToggleButtonController(self, parent, 
RUNNING_KEY, 'Stop', 'Run')
+               control_box.Add(run_button, 0, wx.EXPAND)
                #set sizer
                self.SetSizerAndFit(control_box)
 

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histo_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histo_window.py 
    2009-03-05 01:21:44 UTC (rev 10560)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histo_window.py 
    2009-03-05 19:21:45 UTC (rev 10561)
@@ -50,20 +50,42 @@
                @param parent the wx parent window
                """
                self.parent = parent
-               wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
                control_box = wx.BoxSizer(wx.VERTICAL)
                SIZE = (100, -1)
+               control_box.AddStretchSpacer()
+               control_box.Add(common.LabelText(self, 'Options'), 0, 
wx.ALIGN_CENTER)
+               #minimum
+               control_box.AddStretchSpacer()
+               minimum_ctrl = common.TextBoxController(self, parent, 
MINIMUM_KEY)
+               control_box.Add(common.LabelBox(self, ' Minimum ', 
minimum_ctrl), 0, wx.EXPAND)
+               #maximum
+               maximum_ctrl = common.TextBoxController(self, parent, 
MAXIMUM_KEY)
+               control_box.Add(common.LabelBox(self, ' Maximum ', 
maximum_ctrl), 0, wx.EXPAND)
+               #num bins
+               control_box.AddStretchSpacer()
+               def num_bins_cast(num):
+                       num = int(num)
+                       assert num > 1
+                       return num
+               num_bins_ctrl = common.TextBoxController(self, parent, 
NUM_BINS_KEY, cast=num_bins_cast)
+               control_box.Add(common.LabelBox(self, ' Num Bins ', 
num_bins_ctrl), 0, wx.EXPAND)
+               #frame size
+               frame_size_ctrl = common.TextBoxController(self, parent, 
FRAME_SIZE_KEY, cast=num_bins_cast)
+               control_box.Add(common.LabelBox(self, ' Frame Size ', 
frame_size_ctrl), 0, wx.EXPAND)
                #y axis lvl
-               control_box.AddSpacer(5)
-               hbox = wx.BoxSizer(wx.HORIZONTAL)
-               control_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(self, -1, ' Y Off '), 1, 
wx.ALIGN_CENTER_VERTICAL)
+               control_box.AddStretchSpacer()
                y_off_slider = wx.Slider(self, size=SIZE, 
style=wx.SL_HORIZONTAL)
                y_off_slider.SetRange(0, 1000)
                def y_off_slider_changed(evt): parent[Y_OFF_KEY] = 
float(y_off_slider.GetValue())/y_off_slider.GetMax()
                y_off_slider.Bind(wx.EVT_SLIDER, y_off_slider_changed)
                parent.subscribe(Y_OFF_KEY, lambda x: 
y_off_slider.SetValue(int(round(x*y_off_slider.GetMax()))))
-               hbox.Add(y_off_slider, 0, wx.ALIGN_CENTER_VERTICAL)
+               control_box.Add(common.LabelBox(self, ' Y Off ', y_off_slider), 
0, wx.EXPAND)
+               #autoscale
+               control_box.AddStretchSpacer()
+               self.autoscale_button = wx.Button(self, label='Autoscale', 
style=wx.BU_EXACTFIT)
+               self.autoscale_button.Bind(wx.EVT_BUTTON, self.parent.autoscale)
+               control_box.Add(self.autoscale_button, 0, wx.EXPAND)
                #run/stop
                self.run_button = common.ToggleButtonController(self, parent, 
RUNNING_KEY, 'Stop', 'Run')
                control_box.Add(self.run_button, 0, wx.EXPAND)
@@ -87,8 +109,8 @@
                msg_key,
        ):
                pubsub.pubsub.__init__(self)
-               
                #setup
+               self.samples = list()
                #proxy the keys
                self.proxy(MAXIMUM_KEY, controller, maximum_key)
                self.proxy(MINIMUM_KEY, controller, minimum_key)
@@ -109,11 +131,11 @@
                main_box.Add(self.control_panel, 0, wx.EXPAND)
                self.SetSizerAndFit(main_box)
                #initialize values
-               self[MAXIMUM_KEY] = 1
-               self[MINIMUM_KEY] = -1
-               self[NUM_BINS_KEY] = 31
-               self[FRAME_SIZE_KEY] = 2048
-               self[Y_OFF_KEY] = 0.5
+               self[MAXIMUM_KEY] = self[MAXIMUM_KEY]
+               self[MINIMUM_KEY] = self[MINIMUM_KEY]
+               self[NUM_BINS_KEY] = self[NUM_BINS_KEY]
+               self[FRAME_SIZE_KEY] = self[FRAME_SIZE_KEY]
+               self[Y_OFF_KEY] = 0.25
                self[RUNNING_KEY] = True
                #register events
                self.subscribe(MSG_KEY, self.handle_msg)
@@ -130,27 +152,30 @@
                """
                if not self[RUNNING_KEY]: return
                #convert to floating point numbers
-               samples = numpy.fromstring(msg, 
numpy.float32)[:self[NUM_BINS_KEY]] #only take first frame
-               samples *= 100
+               self.samples = numpy.fromstring(msg, 
numpy.float32)[:self[NUM_BINS_KEY]] #only take first frame
                self.plotter.set_bars(
-                       bars=samples,
+                       bars=self.samples*100,
                        bar_width=0.6,
                        color_spec=(0, 0, 1),
                )
                #update the plotter
                self.plotter.update()
 
+       def autoscale(self, *args):
+               if not len(self.samples): return
+               self[Y_OFF_KEY] = numpy.max(self.samples) + 0.01
+
        def update_grid(self, *args):
                """
                Update the plotter grid.
                Determine the x and y axis grid parameters.
                """
                if self[Y_OFF_KEY] <= 0: self[Y_OFF_KEY] = 0.001; return
+               if self[Y_OFF_KEY] > 1: self[Y_OFF_KEY] = 1.0; return
                #update the x grid
                self.plotter.set_x_grid(
-                       self[MINIMUM_KEY],
-                       self[MAXIMUM_KEY],
-                       (self[MAXIMUM_KEY] - self[MINIMUM_KEY])/8, #TODO histo 
plotter
+                       self[MINIMUM_KEY], self[MAXIMUM_KEY],
+                       (self[MAXIMUM_KEY] - self[MINIMUM_KEY])/8,
                )
                self.plotter.set_x_label('Counts')
                self.plotter.set_y_grid(0, 100.*self[Y_OFF_KEY], 
100.*self[Y_OFF_KEY]/4)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histosink_gl.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histosink_gl.py 
    2009-03-05 01:21:44 UTC (rev 10560)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/histosink_gl.py 
    2009-03-05 19:21:45 UTC (rev 10561)
@@ -41,8 +41,11 @@
                parent,
                size=histo_window.DEFAULT_WIN_SIZE,
                title='',
+               minimum=-1,
+               maximum=1,
+               num_bins=11,
+               frame_size=1000,
        ):
-               
                #init
                gr.hier_block2.__init__(
                        self,
@@ -53,6 +56,10 @@
                #blocks
                msgq = gr.msg_queue(2)
                histo = gr.histo_sink_f(msgq)
+               histo.set_minimum(minimum)
+               histo.set_maximum(maximum)
+               histo.set_num_bins(num_bins)
+               histo.set_frame_size(frame_size)
                #connect
                self.connect(self, histo)
                #controller
@@ -98,7 +105,7 @@
         src2 = gr.sig_source_f (input_rate, gr.GR_SIN_WAVE, 2e3, 1)
         #src2 = gr.sig_source_f (input_rate, gr.GR_CONST_WAVE, 5.75e3, 1)
         thr2 = gr.throttle(gr.sizeof_float, input_rate)
-        sink2 = histo_sink_f (panel, title="Data")
+        sink2 = histo_sink_f (panel, title="Data", minimum=-1.2, maximum=1.2, 
num_bins=21, frame_size=1000)
         vbox.Add (sink2.win, 1, wx.EXPAND)
 
         self.connect(src2, thr2, sink2)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/bar_plotter.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/bar_plotter.py
      2009-03-05 01:21:44 UTC (rev 10560)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/bar_plotter.py
      2009-03-05 19:21:45 UTC (rev 10561)
@@ -27,7 +27,7 @@
 
 LEGEND_TEXT_FONT_SIZE = 8
 LEGEND_BOX_PADDING = 3
-MIN_PADDING = 0, 0, 0, 80 #top, right, bottom, left
+MIN_PADDING = 0, 0, 0, 70 #top, right, bottom, left
 #constants for the waveform storage
 SAMPLES_KEY = 'samples'
 COLOR_SPEC_KEY = 'color_spec'
@@ -112,13 +112,17 @@
                @param y_val the current y value
                @return a string with newlines
                """
+               scalar = float(len(self._bars)-1)/(self.x_max - self.x_min)
                #convert x val to bar #
-               bar_index = (len(self._bars)-1)*(x_val - 
self.x_min)/(self.x_max - self.x_min)
-               if abs(bar_index - round(bar_index)) > self._bar_width/2: 
return ''
+               bar_index = scalar*(x_val - self.x_min)
+               #if abs(bar_index - round(bar_index)) > self._bar_width/2: 
return ''
                bar_index = int(round(bar_index))
+               bar_start = (bar_index - self._bar_width/2)/scalar + self.x_min
+               bar_end = (bar_index + self._bar_width/2)/scalar + self.x_min
                bar_value = self._bars[bar_index]
-               return '%s: %s\n%s: %s'%(
-                       self.x_label, common.eng_format(x_val, self.x_units),
+               return '%s to %s\n%s: %s'%(
+                       common.eng_format(bar_start, self.x_units),
+                       common.eng_format(bar_end, self.x_units),
                        self.y_label, common.eng_format(bar_value, 
self.y_units),
                )
 
@@ -131,7 +135,7 @@
                """
                self.lock()
                self._bars = bars
-               self._bar_width = bar_width
+               self._bar_width = float(bar_width)
                self._color_spec = color_spec
                self._bar_cache.changed(True)
                self.unlock()

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/grid_plotter_base.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/grid_plotter_base.py
        2009-03-05 01:21:44 UTC (rev 10560)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/plotter/grid_plotter_base.py
        2009-03-05 19:21:45 UTC (rev 10561)
@@ -140,7 +140,7 @@
                else:
                        self.x_scalar = 1.0
                        self.x_prefix = ''
-               self._grid_cache.changed(True)
+               for cache in self._gl_caches: cache.changed(True)
                self.unlock()
 
        def set_y_grid(self, minimum, maximum, step, scale=False):
@@ -162,7 +162,7 @@
                else:
                        self.y_scalar = 1.0
                        self.y_prefix = ''
-               self._grid_cache.changed(True)
+               for cache in self._gl_caches: cache.changed(True)
                self.unlock()
 
        def _draw_grid(self):
@@ -192,7 +192,7 @@
                # Resize the padding
                ##################################################
                self.padding_top = max(2*TITLE_LABEL_PADDING + 
title_label.get_size()[1], self.padding_top_min)
-               self.padding_right = max(0, self.padding_right_min)
+               self.padding_right = max(2*TICK_LABEL_PADDING, 
self.padding_right_min)
                self.padding_bottom = max(2*AXIS_LABEL_PADDING + 
TICK_LABEL_PADDING + x_label.get_size()[1] + max([label.get_size()[1] for tick, 
label in x_tick_labels]), self.padding_bottom_min)
                self.padding_left = max(2*AXIS_LABEL_PADDING + 
TICK_LABEL_PADDING + y_label.get_size()[1] + max([label.get_size()[0] for tick, 
label in y_tick_labels]), self.padding_left_min)
                ##################################################

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py 
    2009-03-05 01:21:44 UTC (rev 10560)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py 
    2009-03-05 19:21:45 UTC (rev 10561)
@@ -103,36 +103,24 @@
                scope_mode_box = wx.BoxSizer(wx.VERTICAL)
                control_box.Add(scope_mode_box, 0, wx.EXPAND)
                #x axis divs
-               hbox = wx.BoxSizer(wx.HORIZONTAL)
-               scope_mode_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(self, -1, ' Secs/Div '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                x_buttons = common.IncrDecrButtons(self, self._on_incr_t_divs, 
self._on_decr_t_divs)
-               hbox.Add(x_buttons, 0, wx.ALIGN_CENTER_VERTICAL)
+               scope_mode_box.Add(common.LabelBox(self, ' Secs/Div ', 
x_buttons), 0, wx.EXPAND)
                #y axis divs
-               hbox = wx.BoxSizer(wx.HORIZONTAL)
-               scope_mode_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(self, -1, ' Counts/Div '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                y_buttons = common.IncrDecrButtons(self, self._on_incr_y_divs, 
self._on_decr_y_divs)
                parent.subscribe(AUTORANGE_KEY, y_buttons.Disable)
-               hbox.Add(y_buttons, 0, wx.ALIGN_CENTER_VERTICAL)
+               scope_mode_box.Add(common.LabelBox(self, ' Counts/Div ', 
y_buttons), 0, wx.EXPAND)
                #y axis ref lvl
-               hbox = wx.BoxSizer(wx.HORIZONTAL)
-               scope_mode_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(self, -1, ' Y Offset '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                y_off_buttons = common.IncrDecrButtons(self, 
self._on_incr_y_off, self._on_decr_y_off)
                parent.subscribe(AUTORANGE_KEY, y_off_buttons.Disable)
-               hbox.Add(y_off_buttons, 0, wx.ALIGN_CENTER_VERTICAL)
+               scope_mode_box.Add(common.LabelBox(self, ' Y Offset ', 
y_off_buttons), 0, wx.EXPAND)
                #t axis ref lvl
                scope_mode_box.AddSpacer(5)
-               hbox = wx.BoxSizer(wx.HORIZONTAL)
-               scope_mode_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(self, -1, ' T Offset '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                t_off_slider = wx.Slider(self, size=SIZE, 
style=wx.SL_HORIZONTAL)
                t_off_slider.SetRange(0, 1000)
                def t_off_slider_changed(evt): parent[T_FRAC_OFF_KEY] = 
float(t_off_slider.GetValue())/t_off_slider.GetMax()
                t_off_slider.Bind(wx.EVT_SLIDER, t_off_slider_changed)
                parent.subscribe(T_FRAC_OFF_KEY, lambda x: 
t_off_slider.SetValue(int(round(x*t_off_slider.GetMax()))))
-               hbox.Add(t_off_slider, 0, wx.ALIGN_CENTER_VERTICAL)
+               scope_mode_box.Add(common.LabelBox(self, ' T Offset ', 
t_off_slider), 0, wx.EXPAND)
                scope_mode_box.AddSpacer(5)
                ##################################################
                # XY Mode Box
@@ -140,33 +128,21 @@
                xy_mode_box = wx.BoxSizer(wx.VERTICAL)
                control_box.Add(xy_mode_box, 0, wx.EXPAND)
                #x div controls
-               hbox = wx.BoxSizer(wx.HORIZONTAL)
-               xy_mode_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(self, -1, ' X/Div '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                x_buttons = common.IncrDecrButtons(self, self._on_incr_x_divs, 
self._on_decr_x_divs)
                parent.subscribe(AUTORANGE_KEY, x_buttons.Disable)
-               hbox.Add(x_buttons, 0, wx.ALIGN_CENTER_VERTICAL)
+               xy_mode_box.Add(common.LabelBox(self, ' X/Div ', x_buttons), 0, 
wx.EXPAND)
                #y div controls
-               hbox = wx.BoxSizer(wx.HORIZONTAL)
-               xy_mode_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(self, -1, ' Y/Div '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                y_buttons = common.IncrDecrButtons(self, self._on_incr_y_divs, 
self._on_decr_y_divs)
                parent.subscribe(AUTORANGE_KEY, y_buttons.Disable)
-               hbox.Add(y_buttons, 0, wx.ALIGN_CENTER_VERTICAL)
+               xy_mode_box.Add(common.LabelBox(self, ' Y/Div ', y_buttons), 0, 
wx.EXPAND)
                #x offset controls
-               hbox = wx.BoxSizer(wx.HORIZONTAL)
-               xy_mode_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(self, -1, ' X Off '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                x_off_buttons = common.IncrDecrButtons(self, 
self._on_incr_x_off, self._on_decr_x_off)
                parent.subscribe(AUTORANGE_KEY, x_off_buttons.Disable)
-               hbox.Add(x_off_buttons, 0, wx.ALIGN_CENTER_VERTICAL)
+               xy_mode_box.Add(common.LabelBox(self, ' X Off ', 
x_off_buttons), 0, wx.EXPAND)
                #y offset controls
-               hbox = wx.BoxSizer(wx.HORIZONTAL)
-               xy_mode_box.Add(hbox, 0, wx.EXPAND)
-               hbox.Add(wx.StaticText(self, -1, ' Y Off '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                y_off_buttons = common.IncrDecrButtons(self, 
self._on_incr_y_off, self._on_decr_y_off)
                parent.subscribe(AUTORANGE_KEY, y_off_buttons.Disable)
-               hbox.Add(y_off_buttons, 0, wx.ALIGN_CENTER_VERTICAL)
+               xy_mode_box.Add(common.LabelBox(self, ' Y Off ', 
y_off_buttons), 0, wx.EXPAND)
                xy_mode_box.ShowItems(False)
                def scope_mode_changed(mode):
                        scope_mode_box.ShowItems(mode is None)

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfall_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfall_window.py
 2009-03-05 01:21:44 UTC (rev 10560)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/waterfall_window.py
 2009-03-05 19:21:45 UTC (rev 10561)
@@ -61,7 +61,7 @@
                @param parent the wx parent window
                """
                self.parent = parent
-               wx.Panel.__init__(self, parent, -1, style=wx.SUNKEN_BORDER)
+               wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
                control_box = wx.BoxSizer(wx.VERTICAL)
                control_box.AddStretchSpacer()
                control_box.Add(common.LabelText(self, 'Options'), 0, 
wx.ALIGN_CENTER)





reply via email to

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