Adding ability to easily reload/reset file
authorTom <trondeau@vt.edu>
Mon, 5 Oct 2009 18:55:28 +0000 (14:55 -0400)
committerTom <trondeau@vt.edu>
Mon, 5 Oct 2009 18:55:28 +0000 (14:55 -0400)
gr-utils/src/python/gr_plot_qt.py
gr-utils/src/python/pyqt_plot.py
gr-utils/src/python/pyqt_plot.ui

index a5e3463c8e75dc523025cec9f1473c0e4e6a8c37..5e2b3065c7898e620abd7da7e0126c1e9c0eaa46 100755 (executable)
@@ -154,6 +154,10 @@ class gr_plot_qt(QtGui.QMainWindow):
                      Qt.SIGNAL("activated()"),
                      self.open_file)
         
+        self.connect(self.gui.action_reload,
+                     Qt.SIGNAL("activated()"),
+                     self.reload_file)       
+
         # Set up file position boxes to update current figure
         self.connect(self.gui.filePosStartLineEdit,
                      Qt.SIGNAL("editingFinished()"),
@@ -225,7 +229,11 @@ class gr_plot_qt(QtGui.QMainWindow):
             print filename
             self.initialize(filename)
 
+    def reload_file(self):
+        initialize(self.filename)
+
     def initialize(self, filename):
+        self.filename = filename
         self.hfile = open(filename, "r")
 
         self.setWindowTitle(("GNU Radio File Plot Utility: %s" % filename))
index 74c43c3ebe5e39c13106ae759c2d39bba02d85d6..3b8b4c9e86832f76e72b8cc498277881c68bd3ee 100644 (file)
@@ -2,8 +2,8 @@
 
 # Form implementation generated from reading ui file 'pyqt_plot.ui'
 #
-# Created: Tue Aug 25 18:18:14 2009
-#      by: PyQt4 UI code generator 4.4.3
+# Created: Mon Aug 31 22:12:05 2009
+#      by: PyQt4 UI code generator 4.4.4
 #
 # WARNING! All changes made in this file will be lost!
 
@@ -158,7 +158,7 @@ class Ui_MainWindow(object):
         self.gridLayout.addWidget(self.filePosBox, 3, 0, 1, 1)
         MainWindow.setCentralWidget(self.centralwidget)
         self.menubar = QtGui.QMenuBar(MainWindow)
-        self.menubar.setGeometry(QtCore.QRect(0, 0, 927, 24))
+        self.menubar.setGeometry(QtCore.QRect(0, 0, 927, 25))
         self.menubar.setObjectName("menubar")
         self.menu_File = QtGui.QMenu(self.menubar)
         self.menu_File.setObjectName("menu_File")
@@ -170,7 +170,10 @@ class Ui_MainWindow(object):
         self.action_open.setObjectName("action_open")
         self.action_exit = QtGui.QAction(MainWindow)
         self.action_exit.setObjectName("action_exit")
+        self.action_reload = QtGui.QAction(MainWindow)
+        self.action_reload.setObjectName("action_reload")
         self.menu_File.addAction(self.action_open)
+        self.menu_File.addAction(self.action_reload)
         self.menu_File.addAction(self.action_exit)
         self.menubar.addAction(self.menu_File.menuAction())
 
@@ -202,5 +205,7 @@ class Ui_MainWindow(object):
         self.action_open.setText(QtGui.QApplication.translate("MainWindow", "&Open", None, QtGui.QApplication.UnicodeUTF8))
         self.action_open.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+O", None, QtGui.QApplication.UnicodeUTF8))
         self.action_exit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
+        self.action_reload.setText(QtGui.QApplication.translate("MainWindow", "&Reload", None, QtGui.QApplication.UnicodeUTF8))
+        self.action_reload.setShortcut(QtGui.QApplication.translate("MainWindow", "Ctrl+R", None, QtGui.QApplication.UnicodeUTF8))
 
 from PyQt4 import Qwt5
index 19a62adf549e6111d871ca049fa7842336a92dd2..55c72fda26cedca495791676154fb7f9d2ac370e 100644 (file)
@@ -1,7 +1,8 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>MainWindow</class>
- <widget class="QMainWindow" name="MainWindow" >
-  <property name="geometry" >
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
     <height>696</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>MainWindow</string>
   </property>
-  <widget class="QWidget" name="centralwidget" >
-   <layout class="QGridLayout" name="gridLayout" >
-    <item row="2" column="0" colspan="2" >
-     <widget class="QScrollBar" name="plotHBar" >
-      <property name="orientation" >
+  <widget class="QWidget" name="centralwidget">
+   <layout class="QGridLayout" name="gridLayout">
+    <item row="2" column="0" colspan="2">
+     <widget class="QScrollBar" name="plotHBar">
+      <property name="orientation">
        <enum>Qt::Horizontal</enum>
       </property>
      </widget>
     </item>
-    <item row="1" column="0" >
-     <widget class="QTabWidget" name="tabGroup" >
-      <property name="currentIndex" >
+    <item row="1" column="0">
+     <widget class="QTabWidget" name="tabGroup">
+      <property name="currentIndex">
        <number>0</number>
       </property>
-      <widget class="QWidget" name="timeTab" >
-       <attribute name="title" >
+      <widget class="QWidget" name="timeTab">
+       <attribute name="title">
         <string>Time Domain</string>
        </attribute>
-       <layout class="QHBoxLayout" name="horizontalLayout" >
+       <layout class="QHBoxLayout" name="horizontalLayout">
         <item>
-         <widget class="QwtPlot" name="timePlot" />
+         <widget class="QwtPlot" name="timePlot"/>
         </item>
        </layout>
       </widget>
-      <widget class="QWidget" name="freqTab" >
-       <attribute name="title" >
+      <widget class="QWidget" name="freqTab">
+       <attribute name="title">
         <string>Frequency Domain</string>
        </attribute>
-       <layout class="QHBoxLayout" name="horizontalLayout_2" >
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
         <item>
-         <widget class="QGroupBox" name="fftPropBox" >
-          <property name="minimumSize" >
+         <widget class="QGroupBox" name="fftPropBox">
+          <property name="minimumSize">
            <size>
             <width>160</width>
             <height>0</height>
            </size>
           </property>
-          <property name="title" >
+          <property name="title">
            <string>FFT Properties</string>
           </property>
-          <layout class="QFormLayout" name="formLayout_4" >
-           <property name="fieldGrowthPolicy" >
+          <layout class="QFormLayout" name="formLayout_4">
+           <property name="fieldGrowthPolicy">
             <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
            </property>
-           <item row="0" column="1" >
-            <widget class="QComboBox" name="psdFFTComboBox" >
-             <property name="minimumSize" >
+           <item row="0" column="1">
+            <widget class="QComboBox" name="psdFFTComboBox">
+             <property name="minimumSize">
               <size>
                <width>96</width>
                <height>0</height>
               </size>
              </property>
-             <property name="maximumSize" >
+             <property name="maximumSize">
               <size>
                <width>96</width>
                <height>16777215</height>
@@ -72,9 +73,9 @@
              </property>
             </widget>
            </item>
-           <item row="0" column="0" >
-            <widget class="QLabel" name="psdFFTSizeLabel" >
-             <property name="text" >
+           <item row="0" column="0">
+            <widget class="QLabel" name="psdFFTSizeLabel">
+             <property name="text">
               <string>FFT Size</string>
              </property>
             </widget>
          </widget>
         </item>
         <item>
-         <widget class="QwtPlot" name="freqPlot" />
+         <widget class="QwtPlot" name="freqPlot"/>
         </item>
        </layout>
       </widget>
-      <widget class="QWidget" name="specTab" >
-       <attribute name="title" >
+      <widget class="QWidget" name="specTab">
+       <attribute name="title">
         <string>Spectrogram</string>
        </attribute>
-       <layout class="QHBoxLayout" name="horizontalLayout_3" >
+       <layout class="QHBoxLayout" name="horizontalLayout_3">
         <item>
-         <widget class="QGroupBox" name="groupBox" >
-          <property name="title" >
+         <widget class="QGroupBox" name="groupBox">
+          <property name="title">
            <string>Spectrogram Properties</string>
           </property>
-          <layout class="QFormLayout" name="formLayout_3" >
-           <item row="1" column="0" >
-            <widget class="QLabel" name="specFFTLabel" >
-             <property name="text" >
+          <layout class="QFormLayout" name="formLayout_3">
+           <item row="1" column="0">
+            <widget class="QLabel" name="specFFTLabel">
+             <property name="text">
               <string>FFT Size</string>
              </property>
             </widget>
            </item>
-           <item row="1" column="1" >
-            <widget class="QComboBox" name="specFFTComboBox" >
-             <property name="minimumSize" >
+           <item row="1" column="1">
+            <widget class="QComboBox" name="specFFTComboBox">
+             <property name="minimumSize">
               <size>
                <width>96</width>
                <height>0</height>
               </size>
              </property>
-             <property name="maximumSize" >
+             <property name="maximumSize">
               <size>
                <width>96</width>
                <height>16777215</height>
          </widget>
         </item>
         <item>
-         <widget class="QwtPlot" name="specPlot" />
+         <widget class="QwtPlot" name="specPlot"/>
         </item>
        </layout>
        <zorder>specPlot</zorder>
       </widget>
      </widget>
     </item>
-    <item row="3" column="0" >
-     <widget class="QGroupBox" name="filePosBox" >
-      <property name="minimumSize" >
+    <item row="3" column="0">
+     <widget class="QGroupBox" name="filePosBox">
+      <property name="minimumSize">
        <size>
         <width>0</width>
         <height>120</height>
        </size>
       </property>
-      <property name="title" >
+      <property name="title">
        <string>File Position</string>
       </property>
-      <widget class="QWidget" name="formLayoutWidget_2" >
-       <property name="geometry" >
+      <widget class="QWidget" name="formLayoutWidget_2">
+       <property name="geometry">
         <rect>
          <x>0</x>
          <y>20</y>
          <height>92</height>
         </rect>
        </property>
-       <layout class="QFormLayout" name="filePosLayout" >
-        <item row="0" column="0" >
-         <widget class="QLabel" name="filePosStartLabel" >
-          <property name="text" >
+       <layout class="QFormLayout" name="filePosLayout">
+        <item row="0" column="0">
+         <widget class="QLabel" name="filePosStartLabel">
+          <property name="text">
            <string>Start</string>
           </property>
          </widget>
         </item>
-        <item row="0" column="1" >
-         <widget class="QLineEdit" name="filePosStartLineEdit" />
+        <item row="0" column="1">
+         <widget class="QLineEdit" name="filePosStartLineEdit"/>
         </item>
-        <item row="1" column="0" >
-         <widget class="QLabel" name="filePosStopLabel" >
-          <property name="text" >
+        <item row="1" column="0">
+         <widget class="QLabel" name="filePosStopLabel">
+          <property name="text">
            <string>Stop</string>
           </property>
          </widget>
         </item>
-        <item row="1" column="1" >
-         <widget class="QLineEdit" name="filePosStopLineEdit" />
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="filePosStopLineEdit"/>
         </item>
-        <item row="2" column="0" >
-         <widget class="QLabel" name="filePosLengthLabel" >
-          <property name="text" >
+        <item row="2" column="0">
+         <widget class="QLabel" name="filePosLengthLabel">
+          <property name="text">
            <string>Length</string>
           </property>
          </widget>
         </item>
-        <item row="2" column="1" >
-         <widget class="QLineEdit" name="filePosLengthLineEdit" />
+        <item row="2" column="1">
+         <widget class="QLineEdit" name="filePosLengthLineEdit"/>
         </item>
        </layout>
       </widget>
-      <widget class="QWidget" name="formLayoutWidget_4" >
-       <property name="geometry" >
+      <widget class="QWidget" name="formLayoutWidget_4">
+       <property name="geometry">
         <rect>
          <x>180</x>
          <y>20</y>
          <height>92</height>
         </rect>
        </property>
-       <layout class="QFormLayout" name="fileTimeLayout" >
-        <item row="0" column="0" >
-         <widget class="QLabel" name="fileTimeStartLabel" >
-          <property name="text" >
+       <layout class="QFormLayout" name="fileTimeLayout">
+        <item row="0" column="0">
+         <widget class="QLabel" name="fileTimeStartLabel">
+          <property name="text">
            <string>time start (sec)</string>
           </property>
          </widget>
         </item>
-        <item row="0" column="1" >
-         <widget class="QLineEdit" name="fileTimeStartLineEdit" />
+        <item row="0" column="1">
+         <widget class="QLineEdit" name="fileTimeStartLineEdit"/>
         </item>
-        <item row="1" column="0" >
-         <widget class="QLabel" name="fileTimeStopLabel" >
-          <property name="text" >
+        <item row="1" column="0">
+         <widget class="QLabel" name="fileTimeStopLabel">
+          <property name="text">
            <string>time stop (sec)</string>
           </property>
          </widget>
         </item>
-        <item row="1" column="1" >
-         <widget class="QLineEdit" name="fileTimeStopLineEdit" />
+        <item row="1" column="1">
+         <widget class="QLineEdit" name="fileTimeStopLineEdit"/>
         </item>
-        <item row="2" column="0" >
-         <widget class="QLabel" name="fileTimeLengthLabel" >
-          <property name="text" >
+        <item row="2" column="0">
+         <widget class="QLabel" name="fileTimeLengthLabel">
+          <property name="text">
            <string>time length (sec)</string>
           </property>
          </widget>
         </item>
-        <item row="2" column="1" >
-         <widget class="QLineEdit" name="fileTimeLengthLineEdit" />
+        <item row="2" column="1">
+         <widget class="QLineEdit" name="fileTimeLengthLineEdit"/>
         </item>
        </layout>
       </widget>
-      <widget class="QGroupBox" name="sysGroupBox" >
-       <property name="geometry" >
+      <widget class="QGroupBox" name="sysGroupBox">
+       <property name="geometry">
         <rect>
          <x>530</x>
          <y>0</y>
          <height>120</height>
         </rect>
        </property>
-       <property name="minimumSize" >
+       <property name="minimumSize">
         <size>
          <width>200</width>
          <height>0</height>
         </size>
        </property>
-       <property name="title" >
+       <property name="title">
         <string>System Properties</string>
        </property>
-       <widget class="QWidget" name="formLayoutWidget_3" >
-        <property name="geometry" >
+       <widget class="QWidget" name="formLayoutWidget_3">
+        <property name="geometry">
          <rect>
           <x>0</x>
           <y>20</y>
           <height>91</height>
          </rect>
         </property>
-        <layout class="QFormLayout" name="formLayout_2" >
-         <item row="0" column="0" >
-          <widget class="QLabel" name="sampleRateLabel" >
-           <property name="text" >
+        <layout class="QFormLayout" name="formLayout_2">
+         <item row="0" column="0">
+          <widget class="QLabel" name="sampleRateLabel">
+           <property name="text">
             <string>Sample Rate</string>
            </property>
           </widget>
          </item>
-         <item row="0" column="1" >
-          <widget class="QLineEdit" name="sampleRateLineEdit" >
-           <property name="minimumSize" >
+         <item row="0" column="1">
+          <widget class="QLineEdit" name="sampleRateLineEdit">
+           <property name="minimumSize">
             <size>
              <width>0</width>
              <height>0</height>
         </layout>
        </widget>
       </widget>
-      <widget class="QGroupBox" name="displayGroupBox" >
-       <property name="geometry" >
+      <widget class="QGroupBox" name="displayGroupBox">
+       <property name="geometry">
         <rect>
          <x>730</x>
          <y>0</y>
          <height>120</height>
         </rect>
        </property>
-       <property name="minimumSize" >
+       <property name="minimumSize">
         <size>
          <width>170</width>
          <height>0</height>
         </size>
        </property>
-       <property name="title" >
+       <property name="title">
         <string>Display Properties</string>
        </property>
-       <widget class="QWidget" name="verticalLayoutWidget" >
-        <property name="geometry" >
+       <widget class="QWidget" name="verticalLayoutWidget">
+        <property name="geometry">
          <rect>
           <x>0</x>
           <y>20</y>
           <height>91</height>
          </rect>
         </property>
-        <layout class="QVBoxLayout" name="verticalLayout" >
+        <layout class="QVBoxLayout" name="verticalLayout">
          <item>
-          <widget class="QComboBox" name="colorComboBox" />
+          <widget class="QComboBox" name="colorComboBox"/>
          </item>
          <item>
-          <spacer name="verticalSpacer" >
-           <property name="orientation" >
+          <spacer name="verticalSpacer">
+           <property name="orientation">
             <enum>Qt::Vertical</enum>
            </property>
-           <property name="sizeHint" stdset="0" >
+           <property name="sizeHint" stdset="0">
             <size>
              <width>20</width>
              <height>40</height>
     </item>
    </layout>
   </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>927</width>
-     <height>24</height>
+     <height>25</height>
     </rect>
    </property>
-   <widget class="QMenu" name="menu_File" >
-    <property name="title" >
+   <widget class="QMenu" name="menu_File">
+    <property name="title">
      <string>&amp;File</string>
     </property>
-    <addaction name="action_open" />
-    <addaction name="action_exit" />
+    <addaction name="action_open"/>
+    <addaction name="action_reload"/>
+    <addaction name="action_exit"/>
    </widget>
-   <addaction name="menu_File" />
+   <addaction name="menu_File"/>
   </widget>
-  <widget class="QStatusBar" name="statusbar" />
-  <action name="action_open" >
-   <property name="text" >
+  <widget class="QStatusBar" name="statusbar"/>
+  <action name="action_open">
+   <property name="text">
     <string>&amp;Open</string>
    </property>
-   <property name="shortcut" >
+   <property name="shortcut">
     <string>Ctrl+O</string>
    </property>
   </action>
-  <action name="action_exit" >
-   <property name="text" >
+  <action name="action_exit">
+   <property name="text">
     <string>E&amp;xit</string>
    </property>
   </action>
+  <action name="action_reload">
+   <property name="text">
+    <string>&amp;Reload</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+R</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>
    <receiver>MainWindow</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>399</x>
      <y>347</y>
     </hint>