commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: jblum
Subject: [Commit-gnuradio] r10591 - in gnuradio/branches/developers/jblum/gui_guts: gr-wxgui/src/python grc/data/platforms/python/blocks
Date: Thu, 12 Mar 2009 23:27:20 -0600 (MDT)

Author: jblum
Date: 2009-03-12 23:27:20 -0600 (Thu, 12 Mar 2009)
New Revision: 10591

Modified:
   gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/constants.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_gl.py
   
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_nongl.py
   
gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/wxgui_scopesink2.xml
Log:
WIP AC couple and start in xy mode for grc scope block.
Made nongl scope immune to additional params in gl scope.
Made channel option page for xy mode in scope window.



Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/constants.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/constants.py    
    2009-03-13 02:29:02 UTC (rev 10590)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/constants.py    
    2009-03-13 05:27:20 UTC (rev 10591)
@@ -36,6 +36,7 @@
 GAIN_MU_KEY = 'gain_mu'
 GAIN_OMEGA_KEY = 'gain_omega'
 MARKER_KEY = 'marker'
+XY_MARKER_KEY = 'xy_marker'
 MSG_KEY = 'msg'
 NUM_LINES_KEY = 'num_lines'
 OMEGA_KEY = 'omega'
@@ -43,12 +44,14 @@
 REF_LEVEL_KEY = 'ref_level'
 RUNNING_KEY = 'running'
 SAMPLE_RATE_KEY = 'sample_rate'
-SCOPE_TRIGGER_CHANNEL_KEY = 'scope_trigger_channel'
-SCOPE_TRIGGER_LEVEL_KEY = 'scope_trigger_level'
-SCOPE_TRIGGER_MODE_KEY = 'scope_trigger_mode'
-SCOPE_TRIGGER_SLOPE_KEY = 'scope_trigger_slope'
-SCOPE_TRIGGER_SHOW_KEY = 'scope_trigger_show'
-SCOPE_MODE_KEY = 'scope_mode'
+TRIGGER_CHANNEL_KEY = 'trigger_channel'
+TRIGGER_LEVEL_KEY = 'trigger_level'
+TRIGGER_MODE_KEY = 'trigger_mode'
+TRIGGER_SLOPE_KEY = 'trigger_slope'
+TRIGGER_SHOW_KEY = 'trigger_show'
+XY_MODE_KEY = 'xy_mode'
+X_CHANNEL_KEY = 'x_channel'
+Y_CHANNEL_KEY = 'y_channel'
 T_FRAC_OFF_KEY = 't_frac_off'
 T_DIVS_KEY = 't_divs'
 T_OFF_KEY = 't_off'

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-13 02:29:02 UTC (rev 10590)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scope_window.py 
    2009-03-13 05:27:20 UTC (rev 10591)
@@ -60,7 +60,7 @@
 MARKER_TYPES = (
        ('Line Link', None),
        ('Dot Large', 3.0),
-       ('Dot Medium', 2.0),
+       ('Dot Med', 2.0),
        ('Dot Small', 1.0),
        ('None', 0.0),
 )
@@ -88,14 +88,6 @@
                control_box.AddStretchSpacer()
                control_box.Add(common.LabelText(self, 'Axes Options'), 0, 
wx.ALIGN_CENTER)
                control_box.AddSpacer(2)
-               #scope mode chooser
-               choices = [('Scope', None)]
-               for i in range(parent.num_inputs):
-                       for j in range(parent.num_inputs):
-                               if i == j: continue
-                               choices.append(('Ch%d : Ch%d'%(i+1, j+1), (i, 
j)))
-               scope_mode_chooser = common.DropDownController(self, choices, 
parent, SCOPE_MODE_KEY, SIZE)
-               control_box.Add(common.LabelBox(self, 'Mode', 
scope_mode_chooser), 0, wx.EXPAND)
                ##################################################
                # Scope Mode Box
                ##################################################
@@ -143,11 +135,6 @@
                parent.subscribe(AUTORANGE_KEY, lambda x: 
y_off_buttons.Enable(not x))
                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)
-                       xy_mode_box.ShowItems(mode is not None)
-                       control_box.Layout()
-               parent.subscribe(SCOPE_MODE_KEY, scope_mode_changed)
                #autorange check box
                self.autorange_check_box = common.CheckBoxController(self, 
'Autorange', parent, AUTORANGE_KEY)
                control_box.Add(self.autorange_check_box, 0, wx.ALIGN_LEFT)
@@ -155,21 +142,36 @@
                ##################################################
                # Channel Options
                ##################################################
+               TRIGGER_PAGE_INDEX = parent.num_inputs
+               XY_PAGE_INDEX = parent.num_inputs+1
                control_box.Add(common.LabelText(self, 'Channel Options'), 0, 
wx.ALIGN_CENTER)
                control_box.AddSpacer(2)
                options_notebook = wx.Notebook(self)
                control_box.Add(options_notebook, 0, wx.EXPAND)
-               control_box.AddStretchSpacer()
                def options_notebook_changed(evt):
-                       try: parent[SCOPE_TRIGGER_SHOW_KEY] = 
options_notebook.GetSelection() == parent.num_inputs
+                       try:
+                               parent[TRIGGER_SHOW_KEY] = 
options_notebook.GetSelection() == TRIGGER_PAGE_INDEX
+                               parent[XY_MODE_KEY] = 
options_notebook.GetSelection() == XY_PAGE_INDEX
                        except wx.PyDeadObjectError: pass
                options_notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, 
options_notebook_changed)
+               def xy_mode_changed(mode):
+                       #ensure xy tab is selected
+                       if mode and options_notebook.GetSelection() != 
XY_PAGE_INDEX:
+                               options_notebook.SetSelection(XY_PAGE_INDEX)
+                       #ensure xy tab is not selected
+                       elif not mode and options_notebook.GetSelection() == 
XY_PAGE_INDEX:
+                               options_notebook.SetSelection(0)
+                       #show/hide control buttons
+                       scope_mode_box.ShowItems(not mode)
+                       xy_mode_box.ShowItems(mode)
+                       control_box.Layout()
+               parent.subscribe(XY_MODE_KEY, xy_mode_changed)
                ##################################################
                # Channel Menu Boxes
                ##################################################
                for i in range(parent.num_inputs):
                        channel_menu_panel = wx.Panel(options_notebook)
-                       options_notebook.AddPage(channel_menu_panel, 'Ch 
%d'%(i+1))
+                       options_notebook.AddPage(channel_menu_panel, 
'Ch%d'%(i+1))
                        channel_menu_box = wx.BoxSizer(wx.VERTICAL)
                        channel_menu_panel.SetSizer(channel_menu_box)
                        #ac couple check box
@@ -185,34 +187,55 @@
                # Trigger Menu Box
                ##################################################
                trigger_menu_panel = wx.Panel(options_notebook)
-               options_notebook.AddPage(trigger_menu_panel, 'Trigger')
+               options_notebook.AddPage(trigger_menu_panel, 'Trig')
                trigger_menu_box = wx.BoxSizer(wx.VERTICAL)
                trigger_menu_panel.SetSizer(trigger_menu_box)
                #trigger mode
-               trigger_mode_chooser = 
common.DropDownController(trigger_menu_panel, TRIGGER_MODES, parent, 
SCOPE_TRIGGER_MODE_KEY, SIZE)
+               trigger_mode_chooser = 
common.DropDownController(trigger_menu_panel, TRIGGER_MODES, parent, 
TRIGGER_MODE_KEY, SIZE)
                trigger_menu_box.Add(common.LabelBox(trigger_menu_panel, 
'Mode', trigger_mode_chooser), 0, wx.EXPAND)
                #trigger slope
-               trigger_slope_chooser = 
common.DropDownController(trigger_menu_panel, TRIGGER_SLOPES, parent, 
SCOPE_TRIGGER_SLOPE_KEY, SIZE)
-               parent.subscribe(SCOPE_TRIGGER_MODE_KEY, lambda x: 
trigger_slope_chooser.Enable(x!=gr.gr_TRIG_MODE_FREE))
+               trigger_slope_chooser = 
common.DropDownController(trigger_menu_panel, TRIGGER_SLOPES, parent, 
TRIGGER_SLOPE_KEY, SIZE)
+               parent.subscribe(TRIGGER_MODE_KEY, lambda x: 
trigger_slope_chooser.Enable(x!=gr.gr_TRIG_MODE_FREE))
                trigger_menu_box.Add(common.LabelBox(trigger_menu_panel, 
'Slope', trigger_slope_chooser), 0, wx.EXPAND)
                #trigger channel
                choices = [('Channel %d'%(i+1), i) for i in 
range(parent.num_inputs)]
-               trigger_channel_chooser = 
common.DropDownController(trigger_menu_panel, choices, parent, 
SCOPE_TRIGGER_CHANNEL_KEY, SIZE)
-               parent.subscribe(SCOPE_TRIGGER_MODE_KEY, lambda x: 
trigger_channel_chooser.Enable(x!=gr.gr_TRIG_MODE_FREE))
+               trigger_channel_chooser = 
common.DropDownController(trigger_menu_panel, choices, parent, 
TRIGGER_CHANNEL_KEY, SIZE)
+               parent.subscribe(TRIGGER_MODE_KEY, lambda x: 
trigger_channel_chooser.Enable(x!=gr.gr_TRIG_MODE_FREE))
                trigger_menu_box.Add(common.LabelBox(trigger_menu_panel, 
'Channel', trigger_channel_chooser), 0, wx.EXPAND)
                #trigger level
                hbox = wx.BoxSizer(wx.HORIZONTAL)
                trigger_menu_box.Add(hbox, 0, wx.EXPAND)
                hbox.Add(wx.StaticText(trigger_menu_panel, label=' Level '), 1, 
wx.ALIGN_CENTER_VERTICAL)
                trigger_level_button = wx.Button(trigger_menu_panel, 
label='50%', style=wx.BU_EXACTFIT)
-               parent.subscribe(SCOPE_TRIGGER_MODE_KEY, lambda x: 
trigger_level_button.Enable(x!=gr.gr_TRIG_MODE_FREE))
+               parent.subscribe(TRIGGER_MODE_KEY, lambda x: 
trigger_level_button.Enable(x!=gr.gr_TRIG_MODE_FREE))
                trigger_level_button.Bind(wx.EVT_BUTTON, 
self.parent.set_auto_trigger_level)
                hbox.Add(trigger_level_button, 0, wx.ALIGN_CENTER_VERTICAL)
                hbox.AddSpacer(10)
                trigger_level_buttons = 
common.IncrDecrButtons(trigger_menu_panel, self._on_incr_trigger_level, 
self._on_decr_trigger_level)
-               parent.subscribe(SCOPE_TRIGGER_MODE_KEY, lambda x: 
trigger_level_buttons.Enable(x!=gr.gr_TRIG_MODE_FREE))
+               parent.subscribe(TRIGGER_MODE_KEY, lambda x: 
trigger_level_buttons.Enable(x!=gr.gr_TRIG_MODE_FREE))
                hbox.Add(trigger_level_buttons, 0, wx.ALIGN_CENTER_VERTICAL)
                ##################################################
+               # XY Menu Box
+               ##################################################
+               if parent.num_inputs > 1:
+                       xy_menu_panel = wx.Panel(options_notebook)
+                       options_notebook.AddPage(xy_menu_panel, 'XY')
+                       xy_menu_box = wx.BoxSizer(wx.VERTICAL)
+                       xy_menu_panel.SetSizer(xy_menu_box)
+                       #x and y channel choosers
+                       xy_menu_box.AddStretchSpacer()
+                       choices = [('Ch%d'%(i+1), i) for i in 
range(parent.num_inputs)]
+                       x_channel_chooser = 
common.DropDownController(xy_menu_panel, choices, parent, X_CHANNEL_KEY, SIZE)
+                       xy_menu_box.Add(common.LabelBox(xy_menu_panel, 'Ch X', 
x_channel_chooser), 0, wx.EXPAND)
+                       xy_menu_box.AddStretchSpacer()
+                       y_channel_chooser = 
common.DropDownController(xy_menu_panel, choices, parent, Y_CHANNEL_KEY, SIZE)
+                       xy_menu_box.Add(common.LabelBox(xy_menu_panel, 'Ch Y', 
y_channel_chooser), 0, wx.EXPAND)
+                       #marker
+                       xy_menu_box.AddStretchSpacer()
+                       marker_chooser = 
common.DropDownController(xy_menu_panel, MARKER_TYPES, parent, XY_MARKER_KEY, 
SIZE)
+                       xy_menu_box.Add(common.LabelBox(xy_menu_panel, 
'Marker', marker_chooser), 0, wx.EXPAND)
+                       xy_menu_box.AddStretchSpacer()
+               ##################################################
                # Run/Stop Button
                ##################################################
                #run/stop
@@ -222,7 +245,7 @@
                self.SetSizerAndFit(control_box)
                #mouse wheel event
                def on_mouse_wheel(event):
-                       if parent[SCOPE_MODE_KEY] is None:
+                       if not parent[XY_MODE_KEY]:
                                if event.GetWheelRotation() < 0: 
self._on_incr_t_divs(event)
                                else: self._on_decr_t_divs(event)
                parent.plotter.Bind(wx.EVT_MOUSEWHEEL, on_mouse_wheel)
@@ -232,9 +255,9 @@
        ##################################################
        #trigger level
        def _on_incr_trigger_level(self, event):
-               self.parent[SCOPE_TRIGGER_LEVEL_KEY] += 
self.parent[Y_PER_DIV_KEY]/3.
+               self.parent[TRIGGER_LEVEL_KEY] += self.parent[Y_PER_DIV_KEY]/3.
        def _on_decr_trigger_level(self, event):
-               self.parent[SCOPE_TRIGGER_LEVEL_KEY] -= 
self.parent[Y_PER_DIV_KEY]/3.
+               self.parent[TRIGGER_LEVEL_KEY] -= self.parent[Y_PER_DIV_KEY]/3.
        #incr/decr divs
        def _on_incr_t_divs(self, event):
                self.parent[T_PER_DIV_KEY] = 
common.get_clean_incr(self.parent[T_PER_DIV_KEY])
@@ -288,17 +311,17 @@
                #setup
                self.sampleses = None
                self.num_inputs = num_inputs
-               autorange = v_scale is None
+               autorange = not v_scale
                self.autorange_ts = 0
-               if v_scale is None: v_scale = 1
+               v_scale = v_scale or 1
                self.frame_rate_ts = 0
                #proxy the keys
                self.proxy(MSG_KEY, controller, msg_key)
                self.proxy(SAMPLE_RATE_KEY, controller, sample_rate_key)
-               self.proxy(SCOPE_TRIGGER_LEVEL_KEY, controller, 
trigger_level_key)
-               self.proxy(SCOPE_TRIGGER_MODE_KEY, controller, trigger_mode_key)
-               self.proxy(SCOPE_TRIGGER_SLOPE_KEY, controller, 
trigger_slope_key)
-               self.proxy(SCOPE_TRIGGER_CHANNEL_KEY, controller, 
trigger_channel_key)
+               self.proxy(TRIGGER_LEVEL_KEY, controller, trigger_level_key)
+               self.proxy(TRIGGER_MODE_KEY, controller, trigger_mode_key)
+               self.proxy(TRIGGER_SLOPE_KEY, controller, trigger_slope_key)
+               self.proxy(TRIGGER_CHANNEL_KEY, controller, trigger_channel_key)
                self.proxy(DECIMATION_KEY, controller, decimation_key)
                for i in range(num_inputs):
                        self.proxy(common.index_key(AC_COUPLE_KEY, i), 
controller, common.index_key(ac_couple_key, i))
@@ -320,8 +343,11 @@
                self[RUNNING_KEY] = True
                for i in range(self.num_inputs):
                        self[common.index_key(AC_COUPLE_KEY, i)] = 
self[common.index_key(AC_COUPLE_KEY, i)]
-                       self[common.index_key(MARKER_KEY, i)] = xy_mode and 2.0 
or DEFAULT_MARKER_TYPE
-               self[SCOPE_MODE_KEY] = xy_mode
+                       self[common.index_key(MARKER_KEY, i)] = 
DEFAULT_MARKER_TYPE
+               self[XY_MARKER_KEY] = 2.0
+               self[XY_MODE_KEY] = xy_mode
+               self[X_CHANNEL_KEY] = 0
+               self[Y_CHANNEL_KEY] = self.num_inputs-1
                self[AUTORANGE_KEY] = autorange
                self[T_PER_DIV_KEY] = t_scale
                self[X_PER_DIV_KEY] = v_scale
@@ -333,21 +359,21 @@
                self[X_DIVS_KEY] = 8
                self[Y_DIVS_KEY] = 8
                self[FRAME_RATE_KEY] = frame_rate
-               self[SCOPE_TRIGGER_LEVEL_KEY] = 0
-               self[SCOPE_TRIGGER_CHANNEL_KEY] = 0
-               self[SCOPE_TRIGGER_MODE_KEY] = gr.gr_TRIG_MODE_AUTO
-               self[SCOPE_TRIGGER_SLOPE_KEY] = gr.gr_TRIG_SLOPE_POS
+               self[TRIGGER_LEVEL_KEY] = 0
+               self[TRIGGER_CHANNEL_KEY] = 0
+               self[TRIGGER_MODE_KEY] = gr.gr_TRIG_MODE_AUTO
+               self[TRIGGER_SLOPE_KEY] = gr.gr_TRIG_SLOPE_POS
                self[T_FRAC_OFF_KEY] = 0.5
                #register events for message
                self.subscribe(MSG_KEY, self.handle_msg)
                #register events for grid
                for key in [common.index_key(MARKER_KEY, i) for i in 
range(self.num_inputs)] + [
-                       SCOPE_TRIGGER_LEVEL_KEY, SCOPE_TRIGGER_MODE_KEY,
+                       TRIGGER_LEVEL_KEY, TRIGGER_MODE_KEY,
                        T_PER_DIV_KEY, X_PER_DIV_KEY, Y_PER_DIV_KEY,
                        T_OFF_KEY, X_OFF_KEY, Y_OFF_KEY,
                        T_DIVS_KEY, X_DIVS_KEY, Y_DIVS_KEY,
-                       SCOPE_MODE_KEY, AUTORANGE_KEY, T_FRAC_OFF_KEY,
-                       SCOPE_TRIGGER_SHOW_KEY,
+                       XY_MODE_KEY, AUTORANGE_KEY, T_FRAC_OFF_KEY,
+                       TRIGGER_SHOW_KEY, XY_MARKER_KEY, X_CHANNEL_KEY, 
Y_CHANNEL_KEY,
                ]: self.subscribe(key, self.update_grid)
                #initial update
                self.update_grid()
@@ -378,8 +404,8 @@
                Use the current trigger channel and samples to calculate the 
50% level.
                """
                if not self.sampleses: return
-               samples = self.sampleses[self[SCOPE_TRIGGER_CHANNEL_KEY]]
-               self[SCOPE_TRIGGER_LEVEL_KEY] = 
(numpy.max(samples)+numpy.min(samples))/2
+               samples = self.sampleses[self[TRIGGER_CHANNEL_KEY]]
+               self[TRIGGER_LEVEL_KEY] = 
(numpy.max(samples)+numpy.min(samples))/2
 
        def handle_samples(self):
                """
@@ -388,10 +414,10 @@
                """
                if not self.sampleses: return
                sampleses = self.sampleses
-               if self[SCOPE_MODE_KEY]:
+               if self[XY_MODE_KEY]:
                        self[DECIMATION_KEY] = 1
-                       x_samples = sampleses[self[SCOPE_MODE_KEY][1]]
-                       y_samples = sampleses[self[SCOPE_MODE_KEY][0]]
+                       x_samples = sampleses[self[X_CHANNEL_KEY]]
+                       y_samples = sampleses[self[Y_CHANNEL_KEY]]
                        #autorange
                        if self[AUTORANGE_KEY] and time.time() - 
self.autorange_ts > AUTORANGE_UPDATE_RATE:
                                x_min, x_max = common.get_min_max(x_samples)
@@ -414,7 +440,7 @@
                                channel='XY',
                                samples=(x_samples, y_samples),
                                color_spec=CHANNEL_COLOR_SPECS[0],
-                               marker=self[common.index_key(MARKER_KEY, 0)],
+                               marker=self[XY_MARKER_KEY],
                        )
                        #turn off each waveform
                        for i, samples in enumerate(sampleses):
@@ -461,15 +487,15 @@
                        #turn XY channel off
                        self.plotter.clear_waveform(channel='XY')
                #keep trigger level within range
-               if self[SCOPE_TRIGGER_LEVEL_KEY] > self.get_y_max():
-                       self[SCOPE_TRIGGER_LEVEL_KEY] = self.get_y_max(); return
-               if self[SCOPE_TRIGGER_LEVEL_KEY] < self.get_y_min():
-                       self[SCOPE_TRIGGER_LEVEL_KEY] = self.get_y_min(); return
+               if self[TRIGGER_LEVEL_KEY] > self.get_y_max():
+                       self[TRIGGER_LEVEL_KEY] = self.get_y_max(); return
+               if self[TRIGGER_LEVEL_KEY] < self.get_y_min():
+                       self[TRIGGER_LEVEL_KEY] = self.get_y_min(); return
                #disable the trigger channel
-               if not self[SCOPE_TRIGGER_SHOW_KEY] or self[SCOPE_MODE_KEY] or 
self[SCOPE_TRIGGER_MODE_KEY] == gr.gr_TRIG_MODE_FREE:
+               if not self[TRIGGER_SHOW_KEY] or self[XY_MODE_KEY] or 
self[TRIGGER_MODE_KEY] == gr.gr_TRIG_MODE_FREE:
                        self.plotter.clear_waveform(channel='Trig')
                else: #show trigger channel
-                       trigger_level = self[SCOPE_TRIGGER_LEVEL_KEY]
+                       trigger_level = self[TRIGGER_LEVEL_KEY]
                        trigger_point = 
(len(self.sampleses[0])-1)/self.get_actual_rate()/2.0
                        self.plotter.set_waveform(
                                channel='Trig',
@@ -497,12 +523,12 @@
                """
                if self[T_FRAC_OFF_KEY] < 0: self[T_FRAC_OFF_KEY] = 0; return
                if self[T_FRAC_OFF_KEY] > 1: self[T_FRAC_OFF_KEY] = 1; return
-               if self[SCOPE_MODE_KEY]:
+               if self[XY_MODE_KEY]:
                        #update the x axis
-                       
self.plotter.set_x_label('Ch%d'%(self[SCOPE_MODE_KEY][1]+1))
+                       self.plotter.set_x_label('Ch%d'%(self[X_CHANNEL_KEY]+1))
                        self.plotter.set_x_grid(self.get_x_min(), 
self.get_x_max(), self[X_PER_DIV_KEY])
                        #update the y axis
-                       
self.plotter.set_y_label('Ch%d'%(self[SCOPE_MODE_KEY][0]+1))
+                       self.plotter.set_y_label('Ch%d'%(self[Y_CHANNEL_KEY]+1))
                        self.plotter.set_y_grid(self.get_y_min(), 
self.get_y_max(), self[Y_PER_DIV_KEY])
                else:
                        #update the t axis

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_gl.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_gl.py 
    2009-03-13 02:29:02 UTC (rev 10590)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_gl.py 
    2009-03-13 05:27:20 UTC (rev 10591)
@@ -70,14 +70,14 @@
                title='',
                sample_rate=1,
                size=scope_window.DEFAULT_WIN_SIZE,
-               v_scale=None,
-               t_scale=None,
+               v_scale=0,
+               t_scale=0,
+               xy_mode=False,
+               ac_couple=False,
                num_inputs=1,
-               xy_mode=None,
-               ac_couple=False,
                frame_rate=scope_window.DEFAULT_FRAME_RATE,
        ):
-               if t_scale is None: t_scale = 10.0/sample_rate
+               if not t_scale: t_scale = 10.0/sample_rate
                #init
                gr.hier_block2.__init__(
                        self,
@@ -94,14 +94,14 @@
                self.controller.publish(SAMPLE_RATE_KEY, scope.sample_rate)
                self.controller.subscribe(DECIMATION_KEY, 
scope.set_decimation_count)
                self.controller.publish(DECIMATION_KEY, 
scope.get_decimation_count)
-               self.controller.subscribe(SCOPE_TRIGGER_LEVEL_KEY, 
scope.set_trigger_level)
-               self.controller.publish(SCOPE_TRIGGER_LEVEL_KEY, 
scope.get_trigger_level)
-               self.controller.subscribe(SCOPE_TRIGGER_MODE_KEY, 
scope.set_trigger_mode)
-               self.controller.publish(SCOPE_TRIGGER_MODE_KEY, 
scope.get_trigger_mode)
-               self.controller.subscribe(SCOPE_TRIGGER_SLOPE_KEY, 
scope.set_trigger_slope)
-               self.controller.publish(SCOPE_TRIGGER_SLOPE_KEY, 
scope.get_trigger_slope)
-               self.controller.subscribe(SCOPE_TRIGGER_CHANNEL_KEY, 
scope.set_trigger_channel)
-               self.controller.publish(SCOPE_TRIGGER_CHANNEL_KEY, 
scope.get_trigger_channel)
+               self.controller.subscribe(TRIGGER_LEVEL_KEY, 
scope.set_trigger_level)
+               self.controller.publish(TRIGGER_LEVEL_KEY, 
scope.get_trigger_level)
+               self.controller.subscribe(TRIGGER_MODE_KEY, 
scope.set_trigger_mode)
+               self.controller.publish(TRIGGER_MODE_KEY, 
scope.get_trigger_mode)
+               self.controller.subscribe(TRIGGER_SLOPE_KEY, 
scope.set_trigger_slope)
+               self.controller.publish(TRIGGER_SLOPE_KEY, 
scope.get_trigger_slope)
+               self.controller.subscribe(TRIGGER_CHANNEL_KEY, 
scope.set_trigger_channel)
+               self.controller.publish(TRIGGER_CHANNEL_KEY, 
scope.get_trigger_channel)
                #connect
                if self._real:
                        for i in range(num_inputs):
@@ -136,10 +136,10 @@
                        v_scale=v_scale,
                        xy_mode=xy_mode,
                        ac_couple_key=AC_COUPLE_KEY,
-                       trigger_level_key=SCOPE_TRIGGER_LEVEL_KEY,
-                       trigger_mode_key=SCOPE_TRIGGER_MODE_KEY,
-                       trigger_slope_key=SCOPE_TRIGGER_SLOPE_KEY,
-                       trigger_channel_key=SCOPE_TRIGGER_CHANNEL_KEY,
+                       trigger_level_key=TRIGGER_LEVEL_KEY,
+                       trigger_mode_key=TRIGGER_MODE_KEY,
+                       trigger_slope_key=TRIGGER_SLOPE_KEY,
+                       trigger_channel_key=TRIGGER_CHANNEL_KEY,
                        decimation_key=DECIMATION_KEY,
                        msg_key=MSG_KEY,
                )

Modified: 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_nongl.py
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_nongl.py
  2009-03-13 02:29:02 UTC (rev 10590)
+++ 
gnuradio/branches/developers/jblum/gui_guts/gr-wxgui/src/python/scopesink_nongl.py
  2009-03-13 05:27:20 UTC (rev 10591)
@@ -35,7 +35,7 @@
 class scope_sink_f(gr.hier_block2):
     def __init__(self, parent, title='', sample_rate=1,
                  size=default_scopesink_size, frame_decim=default_frame_decim,
-                 v_scale=default_v_scale, t_scale=None, num_inputs=1):
+                 v_scale=default_v_scale, t_scale=None, num_inputs=1, 
**kwargs):
 
         gr.hier_block2.__init__(self, "scope_sink_f",
                                 gr.io_signature(num_inputs, num_inputs, 
gr.sizeof_float),
@@ -56,7 +56,7 @@
 class scope_sink_c(gr.hier_block2):
     def __init__(self, parent, title='', sample_rate=1,
                  size=default_scopesink_size, frame_decim=default_frame_decim,
-                 v_scale=default_v_scale, t_scale=None, num_inputs=1):
+                 v_scale=default_v_scale, t_scale=None, num_inputs=1, 
**kwargs):
 
         gr.hier_block2.__init__(self, "scope_sink_c",
                                 gr.io_signature(num_inputs, num_inputs, 
gr.sizeof_gr_complex),
@@ -167,10 +167,7 @@
 
         self.marker = 'line'
         self.xy = xy
-        if v_scale == None:        # 0 and None are both False, but 0 != None
-            self.autorange = True
-        else:
-            self.autorange = False # 0 is a valid v_scale            
+        self.autorange = not v_scale
         self.running = True
 
     def get_time_per_div (self):

Modified: 
gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/wxgui_scopesink2.xml
===================================================================
--- 
gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/wxgui_scopesink2.xml
   2009-03-13 02:29:02 UTC (rev 10590)
+++ 
gnuradio/branches/developers/jblum/gui_guts/grc/data/platforms/python/blocks/wxgui_scopesink2.xml
   2009-03-13 05:27:20 UTC (rev 10591)
@@ -13,8 +13,10 @@
        self.GetWin(),
        title=$title,
        sample_rate=$samp_rate,
-       v_scale=#if $v_scale.eval then $v_scale else 'None'#,
+       v_scale=$v_scale,
        t_scale=$t_scale,
+       ac_couple=$ac_couple,
+       xy_mode=$xy_mode,
        num_inputs=$num_inputs,
 )
 #set $grid_pos = $grid_pos.eval
@@ -61,10 +63,40 @@
        <param>
                <name>T Scale</name>
                <key>t_scale</key>
-               <value>10.0/samp_rate</value>
+               <value>0</value>
                <type>real</type>
        </param>
        <param>
+               <name>AC Couple</name>
+               <key>ac_couple</key>
+               <value>False</value>
+               <type>enum</type>
+               <hide>#if $ac_couple.eval == 'True' then 'none' else 
'part'#</hide>
+               <option>
+                       <name>Off</name>
+                       <key>False</key>
+               </option>
+               <option>
+                       <name>On</name>
+                       <key>True</key>
+               </option>
+       </param>
+       <param>
+               <name>XY Mode</name>
+               <key>xy_mode</key>
+               <value>False</value>
+               <type>enum</type>
+               <hide>#if $xy_mode.eval == 'True' then 'none' else 
'part'#</hide>
+               <option>
+                       <name>Off</name>
+                       <key>False</key>
+               </option>
+               <option>
+                       <name>On</name>
+                       <key>True</key>
+               </option>
+       </param>
+       <param>
                <name>Num Inputs</name>
                <key>num_inputs</key>
                <value>1</value>
@@ -76,6 +108,7 @@
                <value></value>
                <type>grid_pos</type>
        </param>
+       <check>not $xy_mode or '$type' == 'complex' or $num_inputs != 1</check>
        <sink>
                <name>in</name>
                <type>$type</type>
@@ -84,6 +117,10 @@
        <doc>
 Set the V Scale to 0 for the scope to auto-scale.
 
+Set the T Scale to 0 for automatic setting.
+
+XY Mode allows the scope to initialize as an XY plotter.
+
 Use the Grid Position (row, column, row span, column span) to position the 
graphical element in the window.
        </doc>
 </block>





reply via email to

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