Fix gain slider for configurations that have no gain control
authorjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Mon, 27 Oct 2008 00:22:12 +0000 (00:22 +0000)
committerjcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5>
Mon, 27 Oct 2008 00:22:12 +0000 (00:22 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9862 221aa14e-8319-0410-a670-987f0aec2ac5

gr-utils/src/python/usrp2_fft.py

index 54defd60d3d974716a944598b7fdcb680588f734..c4b73753ce34ae9295959796c3bdea1c39c18cb6 100755 (executable)
@@ -133,10 +133,10 @@ class app_top_block(stdgui2.std_top_block):
 
         hbox.Add((5,0), 0, 0)
         g = self.u.gain_range()
-       if self.u.daughterboard_id() == 0x0003: # FIXME: get range right in firmware for TVRX
-         g[1] = 104
-         
-        myform['gain'] = form.slider_field(parent=self.panel, sizer=hbox, label="Gain",
+
+       # some configurations don't have gain control
+       if g[1] > g[0]:
+           myform['gain'] = form.slider_field(parent=self.panel, sizer=hbox, label="Gain",
                                            weight=3,
                                            min=int(g[0]), max=int(g[1]),
                                            callback=self.set_gain)
@@ -218,7 +218,8 @@ class app_top_block(stdgui2.std_top_block):
         return False
 
     def set_gain(self, gain):
-        self.myform['gain'].set_value(gain)     # update displayed value
+       if self.myform.has_key('gain'):
+           self.myform['gain'].set_value(gain)     # update displayed value
         self.u.set_gain(gain)
 
     def set_decim(self, decim):