commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11237 - gnuradio/branches/developers/trondeau/qt/gnur


From: trondeau
Subject: [Commit-gnuradio] r11237 - gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2
Date: Thu, 18 Jun 2009 20:18:21 -0600 (MDT)

Author: trondeau
Date: 2009-06-18 20:18:21 -0600 (Thu, 18 Jun 2009)
New Revision: 11237

Modified:
   
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/qt_wfm_interface.py
   
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/qt_wfm_interface.ui
   
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/usrp2_wfm_qt.py
Log:
Adding volume control

Modified: 
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/qt_wfm_interface.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/qt_wfm_interface.py
 2009-06-19 00:50:58 UTC (rev 11236)
+++ 
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/qt_wfm_interface.py
 2009-06-19 02:18:21 UTC (rev 11237)
@@ -2,7 +2,7 @@
 
 # Form implementation generated from reading ui file 'qt_wfm_interface.ui'
 #
-# Created: Thu Jun 18 19:43:37 2009
+# Created: Thu Jun 18 22:17:45 2009
 #      by: PyQt4 UI code generator 4.4.3
 #
 # WARNING! All changes made in this file will be lost!
@@ -52,9 +52,18 @@
         self.pauseButton = QtGui.QPushButton(self.centralwidget)
         self.pauseButton.setGeometry(QtCore.QRect(790, 520, 101, 31))
         self.pauseButton.setObjectName("pauseButton")
+        self.fmBox = QtGui.QGroupBox(self.centralwidget)
+        self.fmBox.setGeometry(QtCore.QRect(290, 520, 251, 131))
+        self.fmBox.setObjectName("fmBox")
+        self.volumeEdit = QtGui.QLineEdit(self.fmBox)
+        self.volumeEdit.setGeometry(QtCore.QRect(130, 20, 113, 23))
+        self.volumeEdit.setObjectName("volumeEdit")
+        self.volumeLabel = QtGui.QLabel(self.fmBox)
+        self.volumeLabel.setGeometry(QtCore.QRect(10, 20, 111, 17))
+        self.volumeLabel.setObjectName("volumeLabel")
         InterfaceWindow.setCentralWidget(self.centralwidget)
         self.menubar = QtGui.QMenuBar(InterfaceWindow)
-        self.menubar.setGeometry(QtCore.QRect(0, 0, 909, 22))
+        self.menubar.setGeometry(QtCore.QRect(0, 0, 909, 24))
         self.menubar.setObjectName("menubar")
         self.menuFile = QtGui.QMenu(self.menubar)
         self.menuFile.setObjectName("menuFile")
@@ -83,6 +92,8 @@
         self.gainLabel.setText(QtGui.QApplication.translate("InterfaceWindow", 
"Gain (dB)", None, QtGui.QApplication.UnicodeUTF8))
         self.freqLabel.setText(QtGui.QApplication.translate("InterfaceWindow", 
"Frequency", None, QtGui.QApplication.UnicodeUTF8))
         
self.pauseButton.setText(QtGui.QApplication.translate("InterfaceWindow", 
"Pause", None, QtGui.QApplication.UnicodeUTF8))
+        self.fmBox.setTitle(QtGui.QApplication.translate("InterfaceWindow", 
"FM Tuner Parameters", None, QtGui.QApplication.UnicodeUTF8))
+        
self.volumeLabel.setText(QtGui.QApplication.translate("InterfaceWindow", 
"Volume", None, QtGui.QApplication.UnicodeUTF8))
         self.menuFile.setTitle(QtGui.QApplication.translate("InterfaceWindow", 
"&File", None, QtGui.QApplication.UnicodeUTF8))
         
self.actionExit.setText(QtGui.QApplication.translate("InterfaceWindow", 
"E&xit", None, QtGui.QApplication.UnicodeUTF8))
 

Modified: 
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/qt_wfm_interface.ui
===================================================================
--- 
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/qt_wfm_interface.ui
 2009-06-19 00:50:58 UTC (rev 11236)
+++ 
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/qt_wfm_interface.ui
 2009-06-19 02:18:21 UTC (rev 11237)
@@ -1,8 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
+<ui version="4.0" >
  <class>InterfaceWindow</class>
- <widget class="QMainWindow" name="InterfaceWindow">
-  <property name="geometry">
+ <widget class="QMainWindow" name="InterfaceWindow" >
+  <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
@@ -10,12 +9,12 @@
     <height>711</height>
    </rect>
   </property>
-  <property name="windowTitle">
+  <property name="windowTitle" >
    <string>MainWindow</string>
   </property>
-  <widget class="QWidget" name="centralwidget">
-   <widget class="QPushButton" name="closeButton">
-    <property name="geometry">
+  <widget class="QWidget" name="centralwidget" >
+   <widget class="QPushButton" name="closeButton" >
+    <property name="geometry" >
      <rect>
       <x>790</x>
       <y>580</y>
@@ -23,12 +22,12 @@
       <height>31</height>
      </rect>
     </property>
-    <property name="text">
+    <property name="text" >
      <string>Close</string>
     </property>
    </widget>
-   <widget class="QFrame" name="sinkFrame">
-    <property name="geometry">
+   <widget class="QFrame" name="sinkFrame" >
+    <property name="geometry" >
      <rect>
       <x>10</x>
       <y>10</y>
@@ -36,14 +35,14 @@
       <height>501</height>
      </rect>
     </property>
-    <property name="frameShape">
+    <property name="frameShape" >
      <enum>QFrame::StyledPanel</enum>
     </property>
-    <property name="frameShadow">
+    <property name="frameShadow" >
      <enum>QFrame::Raised</enum>
     </property>
-    <widget class="QWidget" name="horizontalLayoutWidget">
-     <property name="geometry">
+    <widget class="QWidget" name="horizontalLayoutWidget" >
+     <property name="geometry" >
       <rect>
        <x>10</x>
        <y>10</y>
@@ -51,11 +50,11 @@
        <height>481</height>
       </rect>
      </property>
-     <layout class="QHBoxLayout" name="sinkLayout"/>
+     <layout class="QHBoxLayout" name="sinkLayout" />
     </widget>
    </widget>
-   <widget class="QGroupBox" name="channelModeBox">
-    <property name="geometry">
+   <widget class="QGroupBox" name="channelModeBox" >
+    <property name="geometry" >
      <rect>
       <x>10</x>
       <y>520</y>
@@ -63,11 +62,11 @@
       <height>131</height>
      </rect>
     </property>
-    <property name="title">
+    <property name="title" >
      <string>USRP Parameters</string>
     </property>
-    <widget class="QLabel" name="decimLabel">
-     <property name="geometry">
+    <widget class="QLabel" name="decimLabel" >
+     <property name="geometry" >
       <rect>
        <x>10</x>
        <y>90</y>
@@ -75,12 +74,12 @@
        <height>17</height>
       </rect>
      </property>
-     <property name="text">
+     <property name="text" >
       <string>Decim Rate</string>
      </property>
     </widget>
-    <widget class="QLineEdit" name="decimEdit">
-     <property name="geometry">
+    <widget class="QLineEdit" name="decimEdit" >
+     <property name="geometry" >
       <rect>
        <x>130</x>
        <y>90</y>
@@ -89,8 +88,8 @@
       </rect>
      </property>
     </widget>
-    <widget class="QLineEdit" name="gainEdit">
-     <property name="geometry">
+    <widget class="QLineEdit" name="gainEdit" >
+     <property name="geometry" >
       <rect>
        <x>130</x>
        <y>60</y>
@@ -99,8 +98,8 @@
       </rect>
      </property>
     </widget>
-    <widget class="QLabel" name="gainLabel">
-     <property name="geometry">
+    <widget class="QLabel" name="gainLabel" >
+     <property name="geometry" >
       <rect>
        <x>10</x>
        <y>60</y>
@@ -108,12 +107,12 @@
        <height>20</height>
       </rect>
      </property>
-     <property name="text">
+     <property name="text" >
       <string>Gain (dB)</string>
      </property>
     </widget>
-    <widget class="QLineEdit" name="freqEdit">
-     <property name="geometry">
+    <widget class="QLineEdit" name="freqEdit" >
+     <property name="geometry" >
       <rect>
        <x>130</x>
        <y>30</y>
@@ -122,8 +121,8 @@
       </rect>
      </property>
     </widget>
-    <widget class="QLabel" name="freqLabel">
-     <property name="geometry">
+    <widget class="QLabel" name="freqLabel" >
+     <property name="geometry" >
       <rect>
        <x>10</x>
        <y>30</y>
@@ -131,13 +130,13 @@
        <height>17</height>
       </rect>
      </property>
-     <property name="text">
+     <property name="text" >
       <string>Frequency</string>
      </property>
     </widget>
    </widget>
-   <widget class="QPushButton" name="pauseButton">
-    <property name="geometry">
+   <widget class="QPushButton" name="pauseButton" >
+    <property name="geometry" >
      <rect>
       <x>790</x>
       <y>520</y>
@@ -145,31 +144,67 @@
       <height>31</height>
      </rect>
     </property>
-    <property name="text">
+    <property name="text" >
      <string>Pause</string>
     </property>
    </widget>
+   <widget class="QGroupBox" name="fmBox" >
+    <property name="geometry" >
+     <rect>
+      <x>290</x>
+      <y>520</y>
+      <width>251</width>
+      <height>131</height>
+     </rect>
+    </property>
+    <property name="title" >
+     <string>FM Tuner Parameters</string>
+    </property>
+    <widget class="QLineEdit" name="volumeEdit" >
+     <property name="geometry" >
+      <rect>
+       <x>130</x>
+       <y>20</y>
+       <width>113</width>
+       <height>23</height>
+      </rect>
+     </property>
+    </widget>
+    <widget class="QLabel" name="volumeLabel" >
+     <property name="geometry" >
+      <rect>
+       <x>10</x>
+       <y>20</y>
+       <width>111</width>
+       <height>17</height>
+      </rect>
+     </property>
+     <property name="text" >
+      <string>Volume</string>
+     </property>
+    </widget>
+   </widget>
   </widget>
-  <widget class="QMenuBar" name="menubar">
-   <property name="geometry">
+  <widget class="QMenuBar" name="menubar" >
+   <property name="geometry" >
     <rect>
      <x>0</x>
      <y>0</y>
      <width>909</width>
-     <height>22</height>
+     <height>24</height>
     </rect>
    </property>
-   <widget class="QMenu" name="menuFile">
-    <property name="title">
+   <widget class="QMenu" name="menuFile" >
+    <property name="title" >
      <string>&amp;File</string>
     </property>
-    <addaction name="actionExit"/>
+    <addaction name="actionExit" />
    </widget>
-   <addaction name="menuFile"/>
+   <addaction name="menuFile" />
   </widget>
-  <widget class="QStatusBar" name="statusbar"/>
-  <action name="actionExit">
-   <property name="text">
+  <widget class="QStatusBar" name="statusbar" />
+  <action name="actionExit" >
+   <property name="text" >
     <string>E&amp;xit</string>
    </property>
   </action>
@@ -188,11 +223,11 @@
    <receiver>InterfaceWindow</receiver>
    <slot>close()</slot>
    <hints>
-    <hint type="sourcelabel">
+    <hint type="sourcelabel" >
      <x>322</x>
      <y>623</y>
     </hint>
-    <hint type="destinationlabel">
+    <hint type="destinationlabel" >
      <x>66</x>
      <y>561</y>
     </hint>
@@ -204,11 +239,11 @@
    <receiver>InterfaceWindow</receiver>
    <slot>close()</slot>
    <hints>
-    <hint type="sourcelabel">
+    <hint type="sourcelabel" >
      <x>-1</x>
      <y>-1</y>
     </hint>
-    <hint type="destinationlabel">
+    <hint type="destinationlabel" >
      <x>617</x>
      <y>327</y>
     </hint>

Modified: 
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/usrp2_wfm_qt.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/usrp2_wfm_qt.py
     2009-06-19 00:50:58 UTC (rev 11236)
+++ 
gnuradio/branches/developers/trondeau/qt/gnuradio-examples/python/usrp2/usrp2_wfm_qt.py
     2009-06-19 02:18:21 UTC (rev 11237)
@@ -65,6 +65,7 @@
         self.set_decim(self.fg.decim())
         self.set_freq(self.fg.freq())
         self.set_gain(self.fg.gain())
+        self.set_volume(self.fg.volume())
 
         # Add the qtsnk widgets to the hlayout box
         self.gui.sinkLayout.addWidget(snk_usrp)
@@ -82,7 +83,10 @@
         self.connect(self.gui.gainEdit, QtCore.SIGNAL("editingFinished()"),
                      self.gainEditText)
 
+        self.connect(self.gui.volumeEdit, QtCore.SIGNAL("editingFinished()"),
+                     self.volumeEditText)
 
+
     def pauseFg(self):
         if(self.gui.pauseButton.text() == "Pause"):
             self.fg.stop()
@@ -103,6 +107,9 @@
     def set_gain(self, gain):
         self.gui.gainEdit.setText(QtCore.QString("%1").arg(gain))
 
+    def set_volume(self, vol):
+        self.gui.volumeEdit.setText(QtCore.QString("%1").arg(vol))
+
     def decimEditText(self):
         try:
             decim = self.gui.decimEdit.text().toDouble()[0]
@@ -124,9 +131,16 @@
         except RuntimeError:
             pass
 
+    def volumeEditText(self):
+        try:
+            vol = self.gui.volumeEdit.text().toDouble()[0]
+            self.fg.set_volume(vol)
+        except RuntimeError:
+            pass
 
 
 
+
 # ////////////////////////////////////////////////////////////////////
 #        Define the GNU Radio Top Block
 # ////////////////////////////////////////////////////////////////////
@@ -223,7 +237,7 @@
 
         # set initial values
         self.set_gain(self._usrp_gain)
-        self.set_vol(self._volume)
+        self.set_volume(self._volume)
         if not(self.set_freq(self._usrp_freq)):
             print ("Failed to set initial frequency")
 
@@ -252,10 +266,10 @@
         self.main_box.show()
                 
 
-    def set_vol (self, vol):
+    def set_volume (self, vol):
         g = self.volume_range()
-        self.vol = max(g[0], min(g[1], vol))
-        self.volume_control.set_k(10**(self.vol/10))
+        self._volume = max(g[0], min(g[1], vol))
+        self.volume_control.set_k(10**(self._volume/10))
                                         
     def set_freq(self, target_freq):
         """
@@ -282,7 +296,10 @@
     def set_decim(self, decim):
         self._usrp_decim = int(decim)
         self.u.set_decim(self._usrp_decim)
-        
+
+    def volume(self):
+        return self._volume
+    
     def freq(self):
         return self._usrp_freq
 





reply via email to

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