commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10361 - in gnuradio/branches/releases/3.2: gr-wxgui/s


From: jcorgan
Subject: [Commit-gnuradio] r10361 - in gnuradio/branches/releases/3.2: gr-wxgui/src/python grc/data/platforms/python grc/data/platforms/python/blocks grc/src/grc_gnuradio/usrp grc/src/grc_gnuradio/wxgui grc/src/platforms/gui
Date: Sat, 31 Jan 2009 19:36:54 -0700 (MST)

Author: jcorgan
Date: 2009-01-31 19:36:52 -0700 (Sat, 31 Jan 2009)
New Revision: 10361

Added:
   
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/const_source_x.xml
Modified:
   gnuradio/branches/releases/3.2/gr-wxgui/src/python/common.py
   gnuradio/branches/releases/3.2/gr-wxgui/src/python/scope_window.py
   gnuradio/branches/releases/3.2/grc/data/platforms/python/block_tree.xml
   gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/Makefile.am
   
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_dual_sink_x.xml
   
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_dual_source_x.xml
   
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml
   
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_simple_source_x.xml
   
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_fftsink2.xml
   
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_numbersink2.xml
   
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_scopesink2.xml
   
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml
   gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/common.py
   gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/dual_usrp.py
   gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/simple_usrp.py
   
gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/wxgui/callback_controls.py
   gnuradio/branches/releases/3.2/grc/src/platforms/gui/FlowGraph.py
Log:
Merged r10326:10330, r10333, r10343:10345, r10347 from trunk into release 3.2 
branch

Modified: gnuradio/branches/releases/3.2/gr-wxgui/src/python/common.py
===================================================================
--- gnuradio/branches/releases/3.2/gr-wxgui/src/python/common.py        
2009-02-01 02:26:10 UTC (rev 10360)
+++ gnuradio/branches/releases/3.2/gr-wxgui/src/python/common.py        
2009-02-01 02:36:52 UTC (rev 10361)
@@ -259,7 +259,7 @@
        """
        scale_factor = 3
        mean = numpy.average(samples)
-       rms = scale_factor*((numpy.sum((samples-mean)**2)/len(samples))**.5)
+       rms = 
numpy.max([scale_factor*((numpy.sum((samples-mean)**2)/len(samples))**.5), .1])
        min = mean - rms
        max = mean + rms
        return min, max

Modified: gnuradio/branches/releases/3.2/gr-wxgui/src/python/scope_window.py
===================================================================
--- gnuradio/branches/releases/3.2/gr-wxgui/src/python/scope_window.py  
2009-02-01 02:26:10 UTC (rev 10360)
+++ gnuradio/branches/releases/3.2/gr-wxgui/src/python/scope_window.py  
2009-02-01 02:36:52 UTC (rev 10361)
@@ -411,8 +411,8 @@
                        #autorange
                        if self[AUTORANGE_KEY] and time.time() - 
self.autorange_ts > AUTORANGE_UPDATE_RATE:
                                bounds = [common.get_min_max(samples) for 
samples in sampleses]
-                               y_min = numpy.min(*[bound[0] for bound in 
bounds])
-                               y_max = numpy.max(*[bound[1] for bound in 
bounds])
+                               y_min = numpy.min([bound[0] for bound in 
bounds])
+                               y_max = numpy.max([bound[1] for bound in 
bounds])
                                #adjust the y per div
                                y_per_div = 
common.get_clean_num((y_max-y_min)/self[Y_DIVS_KEY])
                                if y_per_div != self[Y_PER_DIV_KEY]: 
self.set_y_per_div(y_per_div)

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/block_tree.xml
===================================================================
--- gnuradio/branches/releases/3.2/grc/data/platforms/python/block_tree.xml     
2009-02-01 02:26:10 UTC (rev 10360)
+++ gnuradio/branches/releases/3.2/grc/data/platforms/python/block_tree.xml     
2009-02-01 02:36:52 UTC (rev 10361)
@@ -8,6 +8,7 @@
        <name></name> <!-- Blank for Root Name -->
        <cat>
                <name>Sources</name>
+               <block>const_source_x</block>
                <block>gr_sig_source_x</block>
                <block>gr_noise_source_x</block>
                <block>gr_vector_source_x</block>

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/Makefile.am
===================================================================
--- gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/Makefile.am 
2009-02-01 02:26:10 UTC (rev 10360)
+++ gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/Makefile.am 
2009-02-01 02:36:52 UTC (rev 10361)
@@ -55,6 +55,7 @@
        blks2_wfm_rcv.xml \
        blks2_wfm_rcv_pll.xml \
        blks2_wfm_tx.xml \
+       const_source_x.xml \
        gr_add_const_vxx.xml \
        gr_add_vxx.xml \
        gr_agc2_xx.xml \

Copied: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/const_source_x.xml
 (from rev 10330, 
gnuradio/trunk/grc/data/platforms/python/blocks/const_source_x.xml)
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/const_source_x.xml
                          (rev 0)
+++ 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/const_source_x.xml
  2009-02-01 02:36:52 UTC (rev 10361)
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<!--
+###################################################
+##Constant Source: Custom wrapper
+###################################################
+ -->
+<block>
+       <name>Constant Source</name>
+       <key>const_source_x</key>
+       <import>from gnuradio import gr</import>
+       <make>gr.sig_source_$(type.fcn)(0, gr.GR_CONST_WAVE, 0, 0, 
$const)</make>
+       <callback>set_offset($const)</callback>
+       <param>
+               <name>Output Type</name>
+               <key>type</key>
+               <type>enum</type>
+               <option>
+                       <name>Complex</name>
+                       <key>complex</key>
+                       <opt>fcn:c</opt>
+                       <opt>const_type:complex</opt>
+               </option>
+               <option>
+                       <name>Float</name>
+                       <key>float</key>
+                       <opt>fcn:f</opt>
+                       <opt>const_type:real</opt>
+               </option>
+               <option>
+                       <name>Int</name>
+                       <key>int</key>
+                       <opt>fcn:i</opt>
+                       <opt>const_type:int</opt>
+               </option>
+               <option>
+                       <name>Short</name>
+                       <key>short</key>
+                       <opt>fcn:s</opt>
+                       <opt>const_type:int</opt>
+               </option>
+       </param>
+       <param>
+               <name>Constant</name>
+               <key>const</key>
+               <value>0</value>
+               <type>$type.const_type</type>
+       </param>
+       <source>
+               <name>out</name>
+               <type>$type</type>
+       </source>
+</block>

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_dual_sink_x.xml
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_dual_sink_x.xml
        2009-02-01 02:26:10 UTC (rev 10360)
+++ 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_dual_sink_x.xml
        2009-02-01 02:36:52 UTC (rev 10361)
@@ -9,6 +9,9 @@
        <key>usrp_dual_sink_x</key>
        <import>from grc_gnuradio import usrp as grc_usrp</import>
        <make>grc_usrp.dual_sink_$(type.fcn)(number=$number)
+#if $format.eval
+self.$(id).set_format(width=$format.width, shift=$format.shift)
+#end if
 self.$(id).set_interp_rate($interpolation)
 self.$(id).set_frequency_a($frequency_a, verbose=True)
 self.$(id).set_frequency_b($frequency_b, verbose=True)
@@ -53,6 +56,25 @@
                </option>
        </param>
        <param>
+               <name>Format</name>
+               <key>format</key>
+               <value></value>
+               <type>enum</type>
+               <hide>#if $format.eval then '' else 'part'#</hide>
+               <option>
+                       <name>16 Bits (Default)</name>
+                       <key></key>
+                       <opt>width:16</opt>
+                       <opt>shift:0</opt>
+               </option>
+               <option>
+                       <name>8 Bits, Shift 8</name>
+                       <key>w8_s8</key>
+                       <opt>width:8</opt>
+                       <opt>shift:8</opt>
+               </option>
+       </param>
+       <param>
                <name>Unit Number</name>
                <key>number</key>
                <value>0</value>

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_dual_source_x.xml
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_dual_source_x.xml
      2009-02-01 02:26:10 UTC (rev 10360)
+++ 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_dual_source_x.xml
      2009-02-01 02:36:52 UTC (rev 10361)
@@ -9,6 +9,9 @@
        <key>usrp_dual_source_x</key>
        <import>from grc_gnuradio import usrp as grc_usrp</import>
        <make>grc_usrp.dual_source_$(type.fcn)(number=$number, 
side_a='$rx_ant_a.side', rx_ant_a='$rx_ant_a.rx_ant', side_b='$rx_ant_b.side', 
rx_ant_b='$rx_ant_b.rx_ant')
+#if $format.eval
+self.$(id).set_format(width=$format.width, shift=$format.shift)
+#end if
 self.$(id).set_decim_rate($decimation)
 self.$(id).set_frequency_a($frequency_a, verbose=True)
 self.$(id).set_frequency_b($frequency_b, verbose=True)
@@ -47,6 +50,25 @@
                </option>
        </param>
        <param>
+               <name>Format</name>
+               <key>format</key>
+               <value></value>
+               <type>enum</type>
+               <hide>#if $format.eval then '' else 'part'#</hide>
+               <option>
+                       <name>16 Bits (Default)</name>
+                       <key></key>
+                       <opt>width:16</opt>
+                       <opt>shift:0</opt>
+               </option>
+               <option>
+                       <name>8 Bits, Shift 8</name>
+                       <key>w8_s8</key>
+                       <opt>width:8</opt>
+                       <opt>shift:8</opt>
+               </option>
+       </param>
+       <param>
                <name>Unit Number</name>
                <key>number</key>
                <value>0</value>
@@ -205,6 +227,7 @@
                        <key>False</key>
                </option>
        </param>
+       <check>'$rx_ant_a' != '$rx_ant_b'</check>
        <source>
                <name>Aout</name>
                <type>$type</type>

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml
      2009-02-01 02:26:10 UTC (rev 10360)
+++ 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_simple_sink_x.xml
      2009-02-01 02:36:52 UTC (rev 10361)
@@ -9,6 +9,9 @@
        <key>usrp_simple_sink_x</key>
        <import>from grc_gnuradio import usrp as grc_usrp</import>
        <make>grc_usrp.simple_sink_$(type.fcn)(number=$number, side='$side')
+#if $format.eval
+self.$(id).set_format(width=$format.width, shift=$format.shift)
+#end if
 self.$(id).set_interp_rate($interpolation)
 self.$(id).set_frequency($frequency, verbose=True)
 self.$(id).set_gain($gain)
@@ -37,6 +40,25 @@
                </option>
        </param>
        <param>
+               <name>Format</name>
+               <key>format</key>
+               <value></value>
+               <type>enum</type>
+               <hide>#if $format.eval then '' else 'part'#</hide>
+               <option>
+                       <name>16 Bits (Default)</name>
+                       <key></key>
+                       <opt>width:16</opt>
+                       <opt>shift:0</opt>
+               </option>
+               <option>
+                       <name>8 Bits, Shift 8</name>
+                       <key>w8_s8</key>
+                       <opt>width:8</opt>
+                       <opt>shift:8</opt>
+               </option>
+       </param>
+       <param>
                <name>Unit Number</name>
                <key>number</key>
                <value>0</value>

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_simple_source_x.xml
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_simple_source_x.xml
    2009-02-01 02:26:10 UTC (rev 10360)
+++ 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/usrp_simple_source_x.xml
    2009-02-01 02:36:52 UTC (rev 10361)
@@ -9,6 +9,9 @@
        <key>usrp_simple_source_x</key>
        <import>from grc_gnuradio import usrp as grc_usrp</import>
        <make>grc_usrp.simple_source_$(type.fcn)(number=$number, side='$side', 
rx_ant='$rx_ant')
+#if $format.eval
+self.$(id).set_format(width=$format.width, shift=$format.shift)
+#end if
 self.$(id).set_decim_rate($decimation)
 self.$(id).set_frequency($frequency, verbose=True)
 self.$(id).set_gain($gain)
@@ -34,6 +37,25 @@
                </option>
        </param>
        <param>
+               <name>Format</name>
+               <key>format</key>
+               <value></value>
+               <type>enum</type>
+               <hide>#if $format.eval then '' else 'part'#</hide>
+               <option>
+                       <name>16 Bits (Default)</name>
+                       <key></key>
+                       <opt>width:16</opt>
+                       <opt>shift:0</opt>
+               </option>
+               <option>
+                       <name>8 Bits, Shift 8</name>
+                       <key>w8_s8</key>
+                       <opt>width:8</opt>
+                       <opt>shift:8</opt>
+               </option>
+       </param>
+       <param>
                <name>Unit Number</name>
                <key>number</key>
                <value>0</value>

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_fftsink2.xml
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_fftsink2.xml
  2009-02-01 02:26:10 UTC (rev 10360)
+++ 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_fftsink2.xml
  2009-02-01 02:36:52 UTC (rev 10361)
@@ -18,11 +18,7 @@
        fft_size=$fft_size,
        fft_rate=$fft_rate,
        average=$average,
-#if $avg_alpha.eval == 0
-       avg_alpha=None,
-#else
-       avg_alpha=$avg_alpha,
-#end if
+       avg_alpha=#if $avg_alpha.eval then $avg_alpha else 'None'#,
        title=$title,
        peak_hold=$peak_hold,
 )
@@ -33,6 +29,7 @@
 self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
 #end if</make>
        <callback>set_baseband_freq($baseband_freq)</callback>
+       <callback>set_sample_rate($samp_rate)</callback>
        <param>
                <name>Type</name>
                <key>type</key>

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_numbersink2.xml
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_numbersink2.xml
       2009-02-01 02:26:10 UTC (rev 10360)
+++ 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_numbersink2.xml
       2009-02-01 02:36:52 UTC (rev 10361)
@@ -20,11 +20,7 @@
        sample_rate=$samp_rate,
        number_rate=$number_rate,
        average=$options.average,
-#if $avg_alpha.eval == 0
-       avg_alpha=None,
-#else
-       avg_alpha=$avg_alpha,
-#end if
+       avg_alpha=#if $avg_alpha.eval then $avg_alpha else 'None'#,
        label=$title,
        peak_hold=$options.peak_hold,
        show_gauge=$show_gauge,

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_scopesink2.xml
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_scopesink2.xml
        2009-02-01 02:26:10 UTC (rev 10360)
+++ 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_scopesink2.xml
        2009-02-01 02:36:52 UTC (rev 10361)
@@ -14,11 +14,7 @@
        title=$title,
        sample_rate=$samp_rate,
        frame_decim=$frame_decim,
-#if $v_scale.eval == 0
-       v_scale=None,
-#else
-       v_scale=$v_scale,
-#end if
+       v_scale=#if $v_scale.eval then $v_scale else 'None'#,
        t_scale=$t_scale,
        num_inputs=$num_inputs,
 )

Modified: 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml
    2009-02-01 02:26:10 UTC (rev 10360)
+++ 
gnuradio/branches/releases/3.2/grc/data/platforms/python/blocks/wxgui_waterfallsink2.xml
    2009-02-01 02:36:52 UTC (rev 10361)
@@ -17,11 +17,7 @@
        fft_size=$fft_size,
        fft_rate=$fft_rate,
        average=$options.average,
-#if $avg_alpha.eval == 0
-       avg_alpha=None,
-#else
-       avg_alpha=$avg_alpha,
-#end if
+       avg_alpha=#if $avg_alpha.eval then $avg_alpha else 'None'#,
        title=$title,
 )
 #set $grid_pos = $grid_pos.eval
@@ -30,6 +26,8 @@
 #else
 self.GridAdd(self.$(id).win, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
 #end if</make>
+       <callback>set_baseband_freq($baseband_freq)</callback>
+       <callback>set_sample_rate($samp_rate)</callback>
        <param>
                <name>Type</name>
                <key>type</key>

Modified: gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/common.py
===================================================================
--- gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/common.py  
2009-02-01 02:26:10 UTC (rev 10360)
+++ gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/common.py  
2009-02-01 02:36:52 UTC (rev 10361)
@@ -22,39 +22,40 @@
 from gnuradio import usrp, gr
 
 ##################################################
-# Set frequency function w/ verbose option
+# USRP base class with common methods
 ##################################################
-def set_frequency(u, which, subdev, frequency, verbose=False):
-       """
-       Set the carrier frequency for the given subdevice.
-       @param u the usrp source/sink
-       @param which specifies the DDC/DUC number
-       @param frequency the carrier frequency in Hz
-       @param verbose if true, print usrp tuning information
-       """
-       r = u.tune(which, subdev, frequency)
-       if not verbose: return
-       print subdev.side_and_name()
-       if r:
-               print "\tr.baseband_frequency =", r.baseband_freq
-               print "\tr.dxc_frequency =", r.dxc_freq
-               print "\tr.residual_frequency =", r.residual_freq
-               print "\tr.inverted =", r.inverted, "\n"
-       else: print >> sys.stderr, 'Error calling tune on subdevice.'
+class usrp_helper(object):
+       def _make_usrp(self, *args, **kwargs): self._u = 
self._usrp_args[0](*args, **kwargs)
+       def _get_u(self): return self._u
+       def _get_io_size(self): return self._usrp_args[1]
+       def _set_frequency(self, which, subdev, frequency, verbose=False):
+               """
+               Set the carrier frequency for the given subdevice.
+               @param which specifies the DDC/DUC number
+               @param frequency the carrier frequency in Hz
+               @param verbose if true, print usrp tuning information
+               """
+               r = self._get_u().tune(which, subdev, frequency)
+               if not verbose: return
+               print subdev.side_and_name()
+               if r:
+                       print "\tr.baseband_frequency =", r.baseband_freq
+                       print "\tr.dxc_frequency =", r.dxc_freq
+                       print "\tr.residual_frequency =", r.residual_freq
+                       print "\tr.inverted =", r.inverted, "\n"
+               else: print >> sys.stderr, 'Error calling tune on subdevice.'
+       def set_format(self, width, shift): 
self._get_u().set_format(self._get_u().make_format(width, shift))
 
 ##################################################
 # Classes to associate usrp constructor w/ io size
 ##################################################
-class usrp_helper(object):
-       def _get_usrp_constructor(self): return self._usrp_args[0]
-       def _get_io_size(self): return self._usrp_args[1]
 class usrp_source_c(usrp_helper): _usrp_args = (usrp.source_c, 
gr.sizeof_gr_complex)
 class usrp_source_s(usrp_helper): _usrp_args = (usrp.source_s, gr.sizeof_short)
 class usrp_sink_c(usrp_helper): _usrp_args = (usrp.sink_c, 
gr.sizeof_gr_complex)
 class usrp_sink_s(usrp_helper): _usrp_args = (usrp.sink_s, gr.sizeof_short)
 
 ##################################################
-# RX antenna definitions and helpers
+# Side spec and antenna spec functions
 ##################################################
 def is_flex(rx_ant): return rx_ant.upper() in ('TX/RX', 'RX2')
 def to_spec(side, rx_ant='RXA'):

Modified: gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/dual_usrp.py
===================================================================
--- gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/dual_usrp.py       
2009-02-01 02:26:10 UTC (rev 10360)
+++ gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/dual_usrp.py       
2009-02-01 02:36:52 UTC (rev 10361)
@@ -43,34 +43,32 @@
                        gr.io_signature(2, 2, self._get_io_size()),
                )
                #create usrp object
-               self._u = self._get_usrp_constructor()(number, nchan=2)
+               self._make_usrp(number, nchan=2)
                #get the mux for output A
                subdev_spec_a = common.to_spec(side_a, rx_ant_a)
-               self._subdev_a = usrp.selected_subdev(self._u, subdev_spec_a)
-               mux_a = usrp.determine_rx_mux_value(self._u, subdev_spec_a)
+               self._subdev_a = usrp.selected_subdev(self._get_u(), 
subdev_spec_a)
+               mux_a = usrp.determine_rx_mux_value(self._get_u(), 
subdev_spec_a)
                #get the mux for output B
                subdev_spec_b = common.to_spec(side_b, rx_ant_b)
-               self._subdev_b = usrp.selected_subdev(self._u, subdev_spec_b)
-               mux_b = usrp.determine_rx_mux_value(self._u, subdev_spec_b)
+               self._subdev_b = usrp.selected_subdev(self._get_u(), 
subdev_spec_b)
+               mux_b = usrp.determine_rx_mux_value(self._get_u(), 
subdev_spec_b)
                #move the lower byte of the mux b into the second byte of the 
mux a
-               self._u.set_mux(((mux_b & 0xff) << 8) | (mux_a - (mux_a & 
0xff00)))
+               self._get_u().set_mux(((mux_b & 0xff) << 8) | (mux_a - (mux_a & 
0xff00)))
                #connect
                deinter = gr.deinterleave(self._get_io_size())
-               self.connect(self._u, deinter)
+               self.connect(self._get_u(), deinter)
                for i in range(2): self.connect((deinter, i), (self, i))
 
-       def set_decim_rate(self, decim): self._u.set_decim_rate(int(decim))
+       def set_decim_rate(self, decim): 
self._get_u().set_decim_rate(int(decim))
        def set_frequency_a(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=0, #ddc0
                        subdev=self._subdev_a,
                        frequency=frequency,
                        verbose=verbose,
                )
        def set_frequency_b(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=1, #ddc1
                        subdev=self._subdev_b,
                        frequency=frequency,
@@ -102,34 +100,32 @@
                        gr.io_signature(0, 0, 0),
                )
                #create usrp object
-               self._u = self._get_usrp_constructor()(number, nchan=2)
+               self._make_usrp(number, nchan=2)
                #get the mux for side A
                subdev_spec_a = common.to_spec('A')
-               self._subdev_a = usrp.selected_subdev(self._u, subdev_spec_a)
-               mux_a = usrp.determine_tx_mux_value(self._u, subdev_spec_a)
+               self._subdev_a = usrp.selected_subdev(self._get_u(), 
subdev_spec_a)
+               mux_a = usrp.determine_tx_mux_value(self._get_u(), 
subdev_spec_a)
                #get the mux for side B
                subdev_spec_b = common.to_spec('B')
-               self._subdev_b = usrp.selected_subdev(self._u, subdev_spec_b)
-               mux_b = usrp.determine_tx_mux_value(self._u, subdev_spec_b)
+               self._subdev_b = usrp.selected_subdev(self._get_u(), 
subdev_spec_b)
+               mux_b = usrp.determine_tx_mux_value(self._get_u(), 
subdev_spec_b)
                #set the mux
-               self._u.set_mux(mux_a | mux_b)
+               self._get_u().set_mux(mux_a | mux_b)
                #connect
                inter = gr.interleave(self._get_io_size())
-               self.connect(inter, self._u)
+               self.connect(inter, self._get_u())
                for i in range(2): self.connect((self, i), (inter, i))
 
-       def set_interp_rate(self, interp): self._u.set_interp_rate(int(interp))
+       def set_interp_rate(self, interp): 
self._get_u().set_interp_rate(int(interp))
        def set_frequency_a(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=self._subdev_a.which(),
                        subdev=self._subdev_a,
                        frequency=frequency,
                        verbose=verbose,
                )
        def set_frequency_b(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=self._subdev_b.which(),
                        subdev=self._subdev_b,
                        frequency=frequency,

Modified: 
gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/simple_usrp.py
===================================================================
--- gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/simple_usrp.py     
2009-02-01 02:26:10 UTC (rev 10360)
+++ gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/usrp/simple_usrp.py     
2009-02-01 02:36:52 UTC (rev 10361)
@@ -41,18 +41,17 @@
                        gr.io_signature(1, 1, self._get_io_size()),
                )
                #create usrp object
-               self._u = self._get_usrp_constructor()(number, nchan=1)
+               self._make_usrp(number, nchan=1)
                subdev_spec = common.to_spec(side, rx_ant)
-               self._u.set_mux(usrp.determine_rx_mux_value(self._u, 
subdev_spec))
-               self._subdev = usrp.selected_subdev(self._u, subdev_spec)
+               
self._get_u().set_mux(usrp.determine_rx_mux_value(self._get_u(), subdev_spec))
+               self._subdev = usrp.selected_subdev(self._get_u(), subdev_spec)
                if common.is_flex(rx_ant): 
self._subdev.select_rx_antenna(rx_ant)
                #connect
-               self.connect(self._u, self)
+               self.connect(self._get_u(), self)
 
-       def set_decim_rate(self, decim): self._u.set_decim_rate(int(decim))
+       def set_decim_rate(self, decim): 
self._get_u().set_decim_rate(int(decim))
        def set_frequency(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=0, #ddc0
                        subdev=self._subdev,
                        frequency=frequency,
@@ -83,17 +82,16 @@
                        gr.io_signature(0, 0, 0),
                )
                #create usrp object
-               self._u = self._get_usrp_constructor()(number, nchan=1)
+               self._make_usrp(number, nchan=1)
                subdev_spec = common.to_spec(side)
-               self._u.set_mux(usrp.determine_tx_mux_value(self._u, 
subdev_spec))
-               self._subdev = usrp.selected_subdev(self._u, subdev_spec)
+               
self._get_u().set_mux(usrp.determine_tx_mux_value(self._get_u(), subdev_spec))
+               self._subdev = usrp.selected_subdev(self._get_u(), subdev_spec)
                #connect
-               self.connect(self, self._u)
+               self.connect(self, self._get_u())
 
-       def set_interp_rate(self, interp): self._u.set_interp_rate(int(interp))
+       def set_interp_rate(self, interp): 
self._get_u().set_interp_rate(int(interp))
        def set_frequency(self, frequency, verbose=False):
-               common.set_frequency(
-                       u=self._u,
+               self._set_frequency(
                        which=self._subdev.which(),
                        subdev=self._subdev,
                        frequency=frequency,

Modified: 
gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/wxgui/callback_controls.py
===================================================================
--- 
gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/wxgui/callback_controls.py  
    2009-02-01 02:26:10 UTC (rev 10360)
+++ 
gnuradio/branches/releases/3.2/grc/src/grc_gnuradio/wxgui/callback_controls.py  
    2009-02-01 02:36:52 UTC (rev 10361)
@@ -20,6 +20,7 @@
 
 import wx
 import sys
+from gnuradio import eng_notation
 
 class LabelText(wx.StaticText):
        """Label text class for uniform labels among all controls."""
@@ -44,6 +45,8 @@
 
        def get_value(self): raise NotImplementedError
 
+       def set_value(self): raise NotImplementedError
+
 class _chooser_control_base(_control_base):
        """House a drop down or radio buttons for variable control."""
 
@@ -184,13 +187,11 @@
                try: slider.SetRange(0, num_steps)
                except Exception, e:
                        print >> sys.stderr, 'Error in set slider range: 
"%s".'%e
-                       sys.exit(-1)
+                       exit(-1)
                slider.Bind(wx.EVT_SCROLL, self._handle_scroll) #bind the 
scrolling event
                self.Add(slider, 0, wx.ALIGN_CENTER)
                #init slider and text box
-               self._value = value
-               self._set_slider_value(self._value) #sets the slider's value
-               self.text_box.SetValue(str(self._value))
+               self.set_value(value)
 
        def get_value(self):
                """
@@ -199,23 +200,36 @@
                """
                return self._value
 
-       def _set_slider_value(self, real_value):
+       def set_value(self, value):
                """
-               Translate the real numerical value into a slider value and,
-               write the value to the slider.
-               @param real_value the numeric value the slider should represent
+               Set the current set value.
+               @param value the value (float)
                """
-               slider_value = (float(real_value) - 
self.min)*self.num_steps/(self.max - self.min)
+               self._value = value
+               self._update_slider()
+               self._update_text_box()
+
+       def _update_slider(self):
+               """
+               Translate the real numerical value into a slider value.
+               """
+               slider_value = (float(self.get_value()) - 
self.min)*self.num_steps/(self.max - self.min)
                self.slider.SetValue(slider_value)
 
+       def _update_text_box(self):
+               """
+               Update the text box value.
+               Convert the value into engineering notation.
+               """
+               
self.text_box.SetValue(eng_notation.num_to_str(self.get_value()))
+
        def _handle_scroll(self, event=None):
                """
                A scroll event is detected. Read the slider, call the callback.
                """
                slider_value = self.slider.GetValue()
                new_value = slider_value*(self.max - self.min)/self.num_steps + 
self.min
-               self.text_box.SetValue(str(new_value))
-               self._value = new_value
+               self.set_value(new_value)
                try: self.call()
                except Exception, e: print >> sys.stderr, 'Error in exec 
callback from handle scroll.\n', e
 
@@ -223,9 +237,8 @@
                """
                An enter key was pressed. Read the text box, call the callback.
                """
-               new_value = float(self.text_box.GetValue())
-               self._set_slider_value(new_value)
-               self._value = new_value
+               new_value = eng_notation.str_to_num(self.text_box.GetValue())
+               self.set_value(new_value)
                try: self.call()
                except Exception, e: print >> sys.stderr, 'Error in exec 
callback from handle enter.\n', e
 

Modified: gnuradio/branches/releases/3.2/grc/src/platforms/gui/FlowGraph.py
===================================================================
--- gnuradio/branches/releases/3.2/grc/src/platforms/gui/FlowGraph.py   
2009-02-01 02:26:10 UTC (rev 10360)
+++ gnuradio/branches/releases/3.2/grc/src/platforms/gui/FlowGraph.py   
2009-02-01 02:36:52 UTC (rev 10361)
@@ -436,12 +436,12 @@
                """
                selected_elements = None
                if self.mouse_pressed:
-                       new_selection = 
self.what_is_selected(self.get_coordinate())
+                       new_selections = 
self.what_is_selected(self.get_coordinate())
                        #update the selections if the new selection is not in 
the current selections
                        #allows us to move entire selected groups of elements
                        if self.get_ctrl_mask() or not (
-                               new_selection and new_selection[0] in 
self.get_selected_elements()
-                       ): selected_elements = new_selection
+                               new_selections and new_selections[0] in 
self.get_selected_elements()
+                       ): selected_elements = new_selections
                else: #called from a mouse release
                        if not self.element_moved and (not 
self.get_selected_elements() or self.get_ctrl_mask()):
                                selected_elements = 
self.what_is_selected(self.get_coordinate(), self.press_coor)
@@ -482,6 +482,7 @@
                self.set_coordinate(coordinate)
                self.time = 0
                self.mouse_pressed = True
+               if double_click: self.unselect()
                self.update_selected_elements()
                #double click detected, bring up params dialog if possible
                if double_click and self.get_selected_block():





reply via email to

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