commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11346 - gnuradio/branches/developers/trondeau/qt/gr-q


From: trondeau
Subject: [Commit-gnuradio] r11346 - gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python
Date: Sun, 5 Jul 2009 11:37:26 -0600 (MDT)

Author: trondeau
Date: 2009-07-05 11:37:26 -0600 (Sun, 05 Jul 2009)
New Revision: 11346

Modified:
   gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display.py
   
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display_qtgui.py
   
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display_qtgui.ui
Log:
Adding ability to save file to USRP display tool.

Modified: 
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display.py    
    2009-07-05 16:11:57 UTC (rev 11345)
+++ 
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display.py    
    2009-07-05 17:37:26 UTC (rev 11346)
@@ -54,6 +54,9 @@
         self.connect(self.gui.amplifierEdit, 
QtCore.SIGNAL("editingFinished()"),
                      self.amplifierEditText)
 
+        self.connect(self.gui.actionSaveData, QtCore.SIGNAL("activated()"),
+                     self.saveData)
+
     def pauseFg(self):
         if(self.gui.pauseButton.text() == "Pause"):
             self.fg.stop()
@@ -117,7 +120,12 @@
         except ValueError:
             pass
 
+    def saveData(self):
+        fileName = QtGui.QFileDialog.getSaveFileName(self, "Save data to 
file", ".");
+        if(len(fileName)):
+            self.fg.save_to_file(str(fileName))
 
+        
 def pick_subdevice(u):
     """
     The user didn't specify a subdevice on the command line.
@@ -197,7 +205,7 @@
             options.freq = float(f[0]+f[1])/2
         self.set_frequency(options.freq)
 
-        self.snk = qtgui.sink_f(self._fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
+        self.snk = qtgui.sink_c(self._fftsize, gr.firdes.WIN_BLACKMAN_hARRIS,
                                 self._freq, self._bandwidth,
                                 "USRP Display",
                                 True, True, False, True, False)
@@ -207,7 +215,7 @@
         self.set_amplifier_gain(0.001)
 
         # Connect the flow graph
-        self.connect(self.u, self.amp, gr.complex_to_real(), self.snk)
+        self.connect(self.u, self.amp, self.snk)
 
 
         # Get the reference pointer to the SpectrumDisplayForm QWidget
@@ -223,6 +231,18 @@
 
         self.main_win.show()
 
+    def save_to_file(self, name):
+        # Pause the flow graph
+        self.stop()
+        self.wait()
+
+        # Add file sink to save data
+        self.file_sink = gr.file_sink(gr.sizeof_gr_complex, name)
+        self.connect(self.amp, self.file_sink)
+
+        # Restart flow graph
+        self.start()
+
     def set_gain(self, gain):
         self._gain = gain
         self.subdev.set_gain(self._gain)

Modified: 
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display_qtgui.py
===================================================================
--- 
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display_qtgui.py
  2009-07-05 16:11:57 UTC (rev 11345)
+++ 
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display_qtgui.py
  2009-07-05 17:37:26 UTC (rev 11346)
@@ -2,7 +2,7 @@
 
 # Form implementation generated from reading ui file 'usrp_display_qtgui.ui'
 #
-# Created: Fri Jul  3 23:14:52 2009
+# Created: Sun Jul  5 13:05:46 2009
 #      by: PyQt4 UI code generator 4.4.3
 #
 # WARNING! All changes made in this file will be lost!
@@ -138,6 +138,9 @@
         MainWindow.setStatusBar(self.statusbar)
         self.actionExit = QtGui.QAction(MainWindow)
         self.actionExit.setObjectName("actionExit")
+        self.actionSaveData = QtGui.QAction(MainWindow)
+        self.actionSaveData.setObjectName("actionSaveData")
+        self.menuFile.addAction(self.actionSaveData)
         self.menuFile.addAction(self.actionExit)
         self.menubar.addAction(self.menuFile.menuAction())
 
@@ -157,4 +160,5 @@
         self.closeButton.setText(QtGui.QApplication.translate("MainWindow", 
"Close", None, QtGui.QApplication.UnicodeUTF8))
         self.menuFile.setTitle(QtGui.QApplication.translate("MainWindow", 
"&File", None, QtGui.QApplication.UnicodeUTF8))
         self.actionExit.setText(QtGui.QApplication.translate("MainWindow", 
"E&xit", None, QtGui.QApplication.UnicodeUTF8))
+        self.actionSaveData.setText(QtGui.QApplication.translate("MainWindow", 
"&Save Data", None, QtGui.QApplication.UnicodeUTF8))
 

Modified: 
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display_qtgui.ui
===================================================================
--- 
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display_qtgui.ui
  2009-07-05 16:11:57 UTC (rev 11345)
+++ 
gnuradio/branches/developers/trondeau/qt/gr-qtgui/src/python/usrp_display_qtgui.ui
  2009-07-05 17:37:26 UTC (rev 11346)
@@ -258,6 +258,7 @@
     <property name="title" >
      <string>&amp;File</string>
     </property>
+    <addaction name="actionSaveData" />
     <addaction name="actionExit" />
    </widget>
    <addaction name="menuFile" />
@@ -268,6 +269,11 @@
     <string>E&amp;xit</string>
    </property>
   </action>
+  <action name="actionSaveData" >
+   <property name="text" >
+    <string>&amp;Save Data</string>
+   </property>
+  </action>
  </widget>
  <resources/>
  <connections>
@@ -278,8 +284,8 @@
    <slot>close()</slot>
    <hints>
     <hint type="sourcelabel" >
-     <x>322</x>
-     <y>623</y>
+     <x>808</x>
+     <y>739</y>
     </hint>
     <hint type="destinationlabel" >
      <x>66</x>





reply via email to

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