From 8096c6e3c398eb605cbb122cb07737085ac6c5c9 Mon Sep 17 00:00:00 2001 From: "Michal Krenek (Mikos)" Date: Mon, 14 Dec 2015 02:01:23 +0100 Subject: [PATCH] Add peak hold and smoothing; fix window maximization at startup; split dock widgets --- .gitignore | 1 + qspectrumanalyzer/__main__.py | 193 +++++- .../languages/qspectrumanalyzer_cs.ts | 177 ++++-- qspectrumanalyzer/qspectrumanalyzer.ui | 600 +++++++++++------- .../qspectrumanalyzer_settings.ui | 35 +- qspectrumanalyzer/qspectrumanalyzer_smooth.ui | 146 +++++ qspectrumanalyzer/ui_qspectrumanalyzer.py | 205 +++--- .../ui_qspectrumanalyzer_settings.py | 19 +- .../ui_qspectrumanalyzer_smooth.py | 79 +++ 9 files changed, 1048 insertions(+), 407 deletions(-) create mode 100644 qspectrumanalyzer/qspectrumanalyzer_smooth.ui create mode 100644 qspectrumanalyzer/ui_qspectrumanalyzer_smooth.py diff --git a/.gitignore b/.gitignore index b355436..5311962 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ __pycache__/ build/ dist/ MANIFEST +*.egg-info diff --git a/qspectrumanalyzer/__main__.py b/qspectrumanalyzer/__main__.py index bb2664e..9866454 100755 --- a/qspectrumanalyzer/__main__.py +++ b/qspectrumanalyzer/__main__.py @@ -8,6 +8,7 @@ import pyqtgraph as pg from PyQt4 import QtCore, QtGui from qspectrumanalyzer.version import __version__ from qspectrumanalyzer.ui_qspectrumanalyzer_settings import Ui_QSpectrumAnalyzerSettings +from qspectrumanalyzer.ui_qspectrumanalyzer_smooth import Ui_QSpectrumAnalyzerSmooth from qspectrumanalyzer.ui_qspectrumanalyzer import Ui_QSpectrumAnalyzerMainWindow @@ -19,6 +20,30 @@ signal.signal(signal.SIGINT, signal.SIG_DFL) signal.signal(signal.SIGTERM, signal.SIG_DFL) +def smooth(x, window_len=11, window='hanning'): + """Smooth 1D signal using specified window with given size""" + x = np.array(x) + if window_len < 3: + return x + + if x.size < window_len: + raise ValueError("Input data length must be greater than window size") + + if window not in ['rectangular', 'hanning', 'hamming', 'bartlett', 'blackman']: + raise ValueError("Window must be 'rectangular', 'hanning', 'hamming', 'bartlett' or 'blackman'") + + if window == 'rectangular': + # Moving average + w = np.ones(window_len, 'd') + else: + w = getattr(np, window)(window_len) + + s = np.r_[2 * x[0] - x[window_len:1:-1], x, 2 * x[-1] - x[-1:-window_len:-1]] + y = np.convolve(w / w.sum(), s, mode='same') + + return y[window_len - 1:-window_len + 1] + + class QSpectrumAnalyzerSettings(QtGui.QDialog, Ui_QSpectrumAnalyzerSettings): """QSpectrumAnalyzer settings dialog""" def __init__(self, parent=None): @@ -42,7 +67,7 @@ class QSpectrumAnalyzerSettings(QtGui.QDialog, Ui_QSpectrumAnalyzerSettings): @QtCore.pyqtSlot() def on_executableButton_clicked(self): """Open file dialog when button is clicked""" - filename = QtGui.QFileDialog.getOpenFileName(self, "QSpectrumAnalyzer - executable") + filename = QtGui.QFileDialog.getOpenFileName(self, self.tr("Select executable - QSpectrumAnalyzer")) if filename: self.executableEdit.setText(filename) @@ -61,6 +86,32 @@ class QSpectrumAnalyzerSettings(QtGui.QDialog, Ui_QSpectrumAnalyzerSettings): QtGui.QDialog.accept(self) +class QSpectrumAnalyzerSmooth(QtGui.QDialog, Ui_QSpectrumAnalyzerSmooth): + """QSpectrumAnalyzer smoothing dialog""" + def __init__(self, parent=None): + # Initialize UI + super().__init__(parent) + self.setupUi(self) + + # Load settings + settings = QtCore.QSettings() + self.windowLengthSpinBox.setValue(int(settings.value("smooth_length") or 11)) + + window_function = str(settings.value("smooth_window") or "hanning") + i = self.windowFunctionComboBox.findText(window_function) + if i == -1: + self.windowFunctionComboBox.setCurrentIndex(0) + else: + self.windowFunctionComboBox.setCurrentIndex(i) + + def accept(self): + """Save settings when dialog is accepted""" + settings = QtCore.QSettings() + settings.setValue("smooth_length", self.windowLengthSpinBox.value()) + settings.setValue("smooth_window", self.windowFunctionComboBox.currentText()) + QtGui.QDialog.accept(self) + + class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWindow): """QSpectrumAnalyzer main window""" def __init__(self, parent=None): @@ -70,8 +121,13 @@ class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWin # Setup rtl_power thread and connect signals self.waterfall_history_size = 100 - self.datacounter = 0 - self.datatimestamp = 0 + self.smooth = False + self.smooth_length = 11 + self.smooth_window = 'hanning' + self.peak_hold = False + self.data_counter = 0 + self.data_timestamp = 0 + self.data_peak_hold = None self.rtl_power_thread = None self.setup_rtl_power_thread() @@ -110,6 +166,9 @@ class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWin # Create spectrum curve self.curve = self.mainPlotWidget.plot() + # Create peak hold curve + self.curve_peak_hold = self.mainPlotWidget.plot(pen='r') + # Create crosshair self.vLine = pg.InfiniteLine(angle=90, movable=False) self.hLine = pg.InfiniteLine(angle=0, movable=False) @@ -161,22 +220,47 @@ class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWin def update_data(self, data): """Update plots when new data is received""" - self.datacounter += 1 - self.update_plot(data) + self.data_counter += 1 + + # Update waterfall self.update_waterfall(data) + # Update main spectrum plot + if self.smooth: + # Apply smoothing to data + data["y"] = smooth(data["y"], + window_len=self.smooth_length, + window=self.smooth_window) + + if self.peak_hold: + if self.data_peak_hold is None: + self.data_peak_hold = data["y"] + else: + # Update peak hold data + for i, y in enumerate(data["y"]): + if y > self.data_peak_hold[i]: + self.data_peak_hold[i] = y + + self.update_plot(data) + + # Show number of hops and how much time did the sweep really take timestamp = time.time() - self.show_status("Sweep time: {:.2f} s".format(timestamp - self.datatimestamp), timeout=0) - self.datatimestamp = timestamp + self.show_status(self.tr("Frequency hops: {} Sweep time: {:.2f} s").format( + self.rtl_power_thread.params["hops"] or self.tr("N/A"), + timestamp - self.data_timestamp + ), timeout=0) + self.data_timestamp = timestamp def update_plot(self, data): """Update main spectrum plot""" self.curve.setData(data["x"], data["y"]) + if self.peak_hold: + self.curve_peak_hold.setData(data["x"], self.data_peak_hold) def update_waterfall(self, data): """Update waterfall plot""" # Create waterfall data array and waterfall image on first run - if self.datacounter == 1: + if self.data_counter == 1: self.waterfallImgArray = np.zeros((self.waterfall_history_size, len(data["x"]))) self.waterfallImg = pg.ImageItem() self.waterfallImg.scale((data["x"][-1] - data["x"][0]) / len(data["x"]), 1) @@ -186,17 +270,17 @@ class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWin # Roll down one and replace leading edge with new data self.waterfallImgArray = np.roll(self.waterfallImgArray, -1, axis=0) self.waterfallImgArray[-1] = data["y"] - self.waterfallImg.setImage(self.waterfallImgArray[-self.datacounter:].T, + self.waterfallImg.setImage(self.waterfallImgArray[-self.data_counter:].T, autoLevels=False, autoRange=False) # Move waterfall image to always start at 0 self.waterfallImg.setPos(data["x"][0], - -self.datacounter if self.datacounter < self.waterfall_history_size + -self.data_counter if self.data_counter < self.waterfall_history_size else -self.waterfall_history_size) # Link histogram widget to waterfall image on first run # (must be done after first data is received or else levels would be wrong) - if self.datacounter == 1: + if self.data_counter == 1: self.waterfallHistogram.setImageItem(self.waterfallImg) def load_settings(self): @@ -209,14 +293,56 @@ class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWin self.gainSpinBox.setValue(int(settings.value("gain") or 0)) self.ppmSpinBox.setValue(int(settings.value("ppm") or 0)) self.cropSpinBox.setValue(int(settings.value("crop") or 0)) + self.peakHoldCheckBox.setChecked(int(settings.value("peak_hold") or 0)) + self.smoothCheckBox.setChecked(int(settings.value("smooth") or 0)) - if settings.value("window_geometry"): - self.restoreGeometry(settings.value("window_geometry")) + # Restore window geometry if settings.value("window_state"): self.restoreState(settings.value("window_state")) if settings.value("plotsplitter_state"): self.plotSplitter.restoreState(settings.value("plotsplitter_state")) + # Migration from older version of config file + if int(settings.value("config_version") or 1) < 2: + # Make tabs from docks when started for first time + self.tabifyDockWidget(self.settingsDockWidget, self.levelsDockWidget) + self.settingsDockWidget.raise_() + self.set_dock_size(self.controlsDockWidget, 0, 0) + self.set_dock_size(self.frequencyDockWidget, 0, 0) + # Update config version + settings.setValue("config_version", 2) + + # Window geometry has to be restored only after show(), because initial + # maximization doesn't work otherwise (at least not in some window managers on X11) + self.show() + if settings.value("window_geometry"): + self.restoreGeometry(settings.value("window_geometry")) + + def set_dock_size(self, dock, width, height): + """Ugly hack for resizing QDockWidget (because it doesn't respect minimumSize / sizePolicy set in Designer) + Link: https://stackoverflow.com/questions/2722939/c-resize-a-docked-qt-qdockwidget-programmatically""" + old_min_size = dock.minimumSize() + old_max_size = dock.maximumSize() + + if width >= 0: + if dock.width() < width: + dock.setMinimumWidth(width) + else: + dock.setMaximumWidth(width) + + if height >= 0: + if dock.height() < height: + dock.setMinimumHeight(height) + else: + dock.setMaximumHeight(height) + + QtCore.QTimer.singleShot(0, lambda: self.set_dock_size_callback(dock, old_min_size, old_max_size)) + + def set_dock_size_callback(self, dock, old_min_size, old_max_size): + """Return to original QDockWidget minimumSize and maximumSize after running set_dock_size()""" + dock.setMinimumSize(old_min_size) + dock.setMaximumSize(old_max_size) + def save_settings(self): """Save spectrum analyzer settings and window geometry""" settings = QtCore.QSettings() @@ -227,7 +353,10 @@ class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWin settings.setValue("gain", int(self.gainSpinBox.value())) settings.setValue("ppm", int(self.ppmSpinBox.value())) settings.setValue("crop", int(self.cropSpinBox.value())) + settings.setValue("peak_hold", int(self.peakHoldCheckBox.isChecked())) + settings.setValue("smooth", int(self.smoothCheckBox.isChecked())) + # Save window geometry settings.setValue("window_geometry", self.saveGeometry()) settings.setValue("window_state", self.saveState()) settings.setValue("plotsplitter_state", self.plotSplitter.saveState()) @@ -240,8 +369,13 @@ class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWin """Start rtl_power thread""" settings = QtCore.QSettings() self.waterfall_history_size = int(settings.value("waterfall_history_size") or 100) - self.datacounter = 0 - self.datatimestamp = time.time() + self.peak_hold = bool(self.peakHoldCheckBox.isChecked()) + self.smooth = bool(self.smoothCheckBox.isChecked()) + self.smooth_length = int(settings.value("smooth_length") or 11) + self.smooth_window = str(settings.value("smooth_window") or "hanning") + self.data_counter = 0 + self.data_peak_hold = None + self.data_timestamp = time.time() if not self.rtl_power_thread.alive: self.rtl_power_thread.setup(float(self.startFreqSpinBox.value()), float(self.stopFreqSpinBox.value()), @@ -271,6 +405,30 @@ class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWin def on_stopButton_clicked(self): self.stop() + @QtCore.pyqtSlot(bool) + def on_peakHoldCheckBox_toggled(self, checked): + self.peak_hold = checked + if not checked: + self.data_peak_hold = None + self.curve_peak_hold.clear() + + @QtCore.pyqtSlot(bool) + def on_smoothCheckBox_toggled(self, checked): + self.smooth = checked + if self.peak_hold: + self.data_peak_hold = None + self.curve_peak_hold.clear() + + @QtCore.pyqtSlot() + def on_smoothButton_clicked(self): + dialog = QSpectrumAnalyzerSmooth(self) + if dialog.exec_(): + settings = QtCore.QSettings() + self.smooth_length = int(settings.value("smooth_length") or 11) + self.smooth_window = str(settings.value("smooth_window") or "hanning") + self.data_peak_hold = None + self.curve_peak_hold.clear() + @QtCore.pyqtSlot() def on_action_Settings_triggered(self): dialog = QSpectrumAnalyzerSettings(self) @@ -279,7 +437,8 @@ class QSpectrumAnalyzerMainWindow(QtGui.QMainWindow, Ui_QSpectrumAnalyzerMainWin @QtCore.pyqtSlot() def on_action_About_triggered(self): - QtGui.QMessageBox.information(self, self.tr("About"), self.tr("QSpectrumAnalyzer {}").format(__version__)) + QtGui.QMessageBox.information(self, self.tr("About - QSpectrumAnalyzer"), + self.tr("QSpectrumAnalyzer {}").format(__version__)) @QtCore.pyqtSlot() def on_action_Quit_triggered(self): @@ -357,6 +516,7 @@ class RtlPowerThread(RtlPowerBaseThread): "stop_freq": stop_freq, "bin_size": bin_size, "interval": interval, + "hops": 0, "gain": gain, "ppm": ppm, "crop": crop, @@ -557,7 +717,6 @@ def main(): app.setOrganizationDomain("qspectrumanalyzer.eutopia.cz") app.setApplicationName("QSpectrumAnalyzer") window = QSpectrumAnalyzerMainWindow() - window.show() sys.exit(app.exec_()) diff --git a/qspectrumanalyzer/languages/qspectrumanalyzer_cs.ts b/qspectrumanalyzer/languages/qspectrumanalyzer_cs.ts index 2b964c0..e3c4c8b 100644 --- a/qspectrumanalyzer/languages/qspectrumanalyzer_cs.ts +++ b/qspectrumanalyzer/languages/qspectrumanalyzer_cs.ts @@ -3,176 +3,249 @@ QSpectrumAnalyzerMainWindow - + QSpectrumAnalyzer - + Settings - + MHz - + kHz - + auto - + Frequency - + Controls - + Levels - - About - - - - + QSpectrumAnalyzer {} - + &File - + &Help - + &Start - + S&top - + Si&ngle shot - + &Settings... - + &Quit - + Ctrl+Q - + &About - + Interval [s]: - + Gain [dB]: - + Corr. [ppm]: - + Crop [%]: - + Start: - + Stop: - + Bin size: + + + Peak hold + + + + + Smoothing + + + + + ... + + + + + N/A + + + + + Frequency hops: {} Sweep time: {:.2f} s + + + + + About - QSpectrumAnalyzer + + QSpectrumAnalyzerSettings - - QSpectrumAnalyzer - Settings - - - - + rtl_power - + ... - - Waterfall history size: - - - - - Backend: - - - - + rtl_power_fftw - - Executable: + + &Backend: - - Sample rate: + + E&xecutable: + + + + + &Waterfall history size: + + + + + Sa&mple rate: + + + + + Select executable - QSpectrumAnalyzer + + + + + Settings - QSpectrumAnalyzer + + + + + QSpectrumAnalyzerSmooth + + + &Window function: + + + + + rectangular + + + + + hanning + + + + + hamming + + + + + bartlett + + + + + blackman + + + + + Window len&gth: + + + + + Smoothing - QSpectrumAnalyzer diff --git a/qspectrumanalyzer/qspectrumanalyzer.ui b/qspectrumanalyzer/qspectrumanalyzer.ui index 1e65605..376dc7f 100644 --- a/qspectrumanalyzer/qspectrumanalyzer.ui +++ b/qspectrumanalyzer/qspectrumanalyzer.ui @@ -6,8 +6,8 @@ 0 0 - 1100 - 731 + 1080 + 776 @@ -51,7 +51,7 @@ 0 0 - 1100 + 1080 30 @@ -73,265 +73,376 @@ - + + + + 0 + 0 + + + + + 190 + 126 + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable + + Controls + 2 - - - - - - Controls + + + + + + &Start + + + + + + + S&top + + + + + + + Si&ngle shot + + + + + + + Qt::Vertical + + + + 20 + 561 + + + + + + + + + + + 0 + 0 + + + + + 156 + 232 + + + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable + + + Frequency + + + 2 + + + + + + + Start: + + + startFreqSpinBox - - - - - &Start - - - - - - - S&top - - - - - - - Si&ngle shot - - - - - - - Frequency + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + MHz + + + 3 + + + 24.000000000000000 + + + 1766.000000000000000 + + + 87.000000000000000 - - - - - Start: - - - startFreqSpinBox - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - MHz - - - 3 - - - 24.000000000000000 - - - 1766.000000000000000 - - - 87.000000000000000 - - - - - - - Stop: - - - stopFreqSpinBox - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - MHz - - - 3 - - - 24.000000000000000 - - - 1766.000000000000000 - - - 108.000000000000000 - - - - - - - Bin size: - - - binSizeSpinBox - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - kHz - - - 3 - - - 2800.000000000000000 - - - 10.000000000000000 - - - - - - - Settings + + + Stop: + + + stopFreqSpinBox - - - - - Interval [s]: - - - intervalSpinBox - - - - - - - Gain [dB]: - - - gainSpinBox - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - auto - - - -1 - - - 49 - - - -1 - - - - - - - Corr. [ppm]: - - - ppmSpinBox - - - - - - - Crop [%]: - - - cropSpinBox - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - -999 - - - 999 - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 999.000000000000000 - - - 1.000000000000000 - - - - - - - Levels + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + MHz + + + 3 + + + 24.000000000000000 + + + 1766.000000000000000 + + + 108.000000000000000 + + + + + + + Bin size: + + + binSizeSpinBox + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + kHz + + + 3 + + + 2800.000000000000000 + + + 10.000000000000000 + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + + + 0 + 0 + + + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable + + + Settings + + + 2 + + + + + + + Smoothing + + + + + + + Corr. [ppm]: + + + ppmSpinBox + + + + + + + Peak hold + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + 999.000000000000000 + + + 1.000000000000000 + + + + + + + ... + + + false + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + auto + + + -1 + + + 49 + + + -1 + + + + + + + Crop [%]: + + + cropSpinBox + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + -999 + + + 999 + + + + + + + Gain [dB]: + + + gainSpinBox + + + + + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Interval [s]: + + + intervalSpinBox + + + + + + + + + + 0 + 0 + + + + QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable + + + Levels + + + 2 + + + + + + + + 0 + 0 + - - - - - - 0 - 0 - - - - - @@ -374,6 +485,9 @@ gainSpinBox ppmSpinBox cropSpinBox + peakHoldCheckBox + smoothCheckBox + smoothButton histogramPlotLayout mainPlotLayout waterfallPlotLayout diff --git a/qspectrumanalyzer/qspectrumanalyzer_settings.ui b/qspectrumanalyzer/qspectrumanalyzer_settings.ui index 51182cb..87398e4 100644 --- a/qspectrumanalyzer/qspectrumanalyzer_settings.ui +++ b/qspectrumanalyzer/qspectrumanalyzer_settings.ui @@ -6,12 +6,12 @@ 0 0 - 350 + 400 210 - QSpectrumAnalyzer - Settings + Settings - QSpectrumAnalyzer @@ -19,7 +19,10 @@ - Backend: + &Backend: + + + backendComboBox @@ -40,7 +43,10 @@ - Executable: + E&xecutable: + + + executableEdit @@ -65,7 +71,10 @@ - Waterfall history size: + &Waterfall history size: + + + waterfallHistorySizeSpinBox @@ -85,7 +94,10 @@ - Sample rate: + Sa&mple rate: + + + sampleRateSpinBox @@ -133,10 +145,11 @@ + backendComboBox executableEdit executableButton waterfallHistorySizeSpinBox - buttonBox + sampleRateSpinBox @@ -147,8 +160,8 @@ accept() - 224 - 126 + 230 + 203 157 @@ -163,8 +176,8 @@ reject() - 292 - 132 + 298 + 203 286 diff --git a/qspectrumanalyzer/qspectrumanalyzer_smooth.ui b/qspectrumanalyzer/qspectrumanalyzer_smooth.ui new file mode 100644 index 0000000..36c1dfa --- /dev/null +++ b/qspectrumanalyzer/qspectrumanalyzer_smooth.ui @@ -0,0 +1,146 @@ + + + QSpectrumAnalyzerSmooth + + + + 0 + 0 + 250 + 130 + + + + Smoothing - QSpectrumAnalyzer + + + + + + + + &Window function: + + + windowFunctionComboBox + + + + + + + 0 + + + + rectangular + + + + + hanning + + + + + hamming + + + + + bartlett + + + + + blackman + + + + + + + + Window len&gth: + + + windowLengthSpinBox + + + + + + + 3 + + + 1001 + + + 11 + + + + + + + + + Qt::Vertical + + + + 20 + 1 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + QSpectrumAnalyzerSmooth + accept() + + + 218 + 104 + + + 157 + 129 + + + + + buttonBox + rejected() + QSpectrumAnalyzerSmooth + reject() + + + 218 + 110 + + + 224 + 129 + + + + + diff --git a/qspectrumanalyzer/ui_qspectrumanalyzer.py b/qspectrumanalyzer/ui_qspectrumanalyzer.py index 23f2707..463d73b 100644 --- a/qspectrumanalyzer/ui_qspectrumanalyzer.py +++ b/qspectrumanalyzer/ui_qspectrumanalyzer.py @@ -25,7 +25,7 @@ except AttributeError: class Ui_QSpectrumAnalyzerMainWindow(object): def setupUi(self, QSpectrumAnalyzerMainWindow): QSpectrumAnalyzerMainWindow.setObjectName(_fromUtf8("QSpectrumAnalyzerMainWindow")) - QSpectrumAnalyzerMainWindow.resize(1100, 731) + QSpectrumAnalyzerMainWindow.resize(1080, 776) self.centralwidget = QtGui.QWidget(QSpectrumAnalyzerMainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget) @@ -55,7 +55,7 @@ class Ui_QSpectrumAnalyzerMainWindow(object): self.horizontalLayout.addWidget(self.plotSplitter) QSpectrumAnalyzerMainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(QSpectrumAnalyzerMainWindow) - self.menubar.setGeometry(QtCore.QRect(0, 0, 1100, 30)) + self.menubar.setGeometry(QtCore.QRect(0, 0, 1080, 30)) self.menubar.setObjectName(_fromUtf8("menubar")) self.menu_File = QtGui.QMenu(self.menubar) self.menu_File.setObjectName(_fromUtf8("menu_File")) @@ -65,35 +65,49 @@ class Ui_QSpectrumAnalyzerMainWindow(object): self.statusbar = QtGui.QStatusBar(QSpectrumAnalyzerMainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) QSpectrumAnalyzerMainWindow.setStatusBar(self.statusbar) - self.dockWidget = QtGui.QDockWidget(QSpectrumAnalyzerMainWindow) - self.dockWidget.setFeatures(QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetMovable) - self.dockWidget.setObjectName(_fromUtf8("dockWidget")) - self.dockWidgetContents = QtGui.QWidget() - self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents")) - self.verticalLayout_3 = QtGui.QVBoxLayout(self.dockWidgetContents) - self.verticalLayout_3.setObjectName(_fromUtf8("verticalLayout_3")) - self.groupBox_2 = QtGui.QGroupBox(self.dockWidgetContents) - self.groupBox_2.setObjectName(_fromUtf8("groupBox_2")) - self.gridLayout = QtGui.QGridLayout(self.groupBox_2) - self.gridLayout.setObjectName(_fromUtf8("gridLayout")) - self.startButton = QtGui.QPushButton(self.groupBox_2) + self.controlsDockWidget = QtGui.QDockWidget(QSpectrumAnalyzerMainWindow) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.controlsDockWidget.sizePolicy().hasHeightForWidth()) + self.controlsDockWidget.setSizePolicy(sizePolicy) + self.controlsDockWidget.setMinimumSize(QtCore.QSize(190, 126)) + self.controlsDockWidget.setFeatures(QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetMovable) + self.controlsDockWidget.setObjectName(_fromUtf8("controlsDockWidget")) + self.controlsDockWidgetContents = QtGui.QWidget() + self.controlsDockWidgetContents.setObjectName(_fromUtf8("controlsDockWidgetContents")) + self.gridLayout_2 = QtGui.QGridLayout(self.controlsDockWidgetContents) + self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) + self.startButton = QtGui.QPushButton(self.controlsDockWidgetContents) self.startButton.setObjectName(_fromUtf8("startButton")) - self.gridLayout.addWidget(self.startButton, 0, 0, 1, 1) - self.stopButton = QtGui.QPushButton(self.groupBox_2) + self.gridLayout_2.addWidget(self.startButton, 0, 0, 1, 1) + self.stopButton = QtGui.QPushButton(self.controlsDockWidgetContents) self.stopButton.setObjectName(_fromUtf8("stopButton")) - self.gridLayout.addWidget(self.stopButton, 0, 1, 1, 1) - self.singleShotButton = QtGui.QPushButton(self.groupBox_2) + self.gridLayout_2.addWidget(self.stopButton, 0, 1, 1, 1) + self.singleShotButton = QtGui.QPushButton(self.controlsDockWidgetContents) self.singleShotButton.setObjectName(_fromUtf8("singleShotButton")) - self.gridLayout.addWidget(self.singleShotButton, 1, 0, 1, 2) - self.verticalLayout_3.addWidget(self.groupBox_2) - self.groupBox = QtGui.QGroupBox(self.dockWidgetContents) - self.groupBox.setObjectName(_fromUtf8("groupBox")) - self.verticalLayout = QtGui.QVBoxLayout(self.groupBox) + self.gridLayout_2.addWidget(self.singleShotButton, 1, 0, 1, 2) + spacerItem = QtGui.QSpacerItem(20, 561, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.gridLayout_2.addItem(spacerItem, 2, 0, 1, 1) + self.controlsDockWidget.setWidget(self.controlsDockWidgetContents) + QSpectrumAnalyzerMainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.controlsDockWidget) + self.frequencyDockWidget = QtGui.QDockWidget(QSpectrumAnalyzerMainWindow) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.frequencyDockWidget.sizePolicy().hasHeightForWidth()) + self.frequencyDockWidget.setSizePolicy(sizePolicy) + self.frequencyDockWidget.setMinimumSize(QtCore.QSize(156, 232)) + self.frequencyDockWidget.setFeatures(QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetMovable) + self.frequencyDockWidget.setObjectName(_fromUtf8("frequencyDockWidget")) + self.frequencyDockWidgetContents = QtGui.QWidget() + self.frequencyDockWidgetContents.setObjectName(_fromUtf8("frequencyDockWidgetContents")) + self.verticalLayout = QtGui.QVBoxLayout(self.frequencyDockWidgetContents) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) - self.label_2 = QtGui.QLabel(self.groupBox) + self.label_2 = QtGui.QLabel(self.frequencyDockWidgetContents) self.label_2.setObjectName(_fromUtf8("label_2")) self.verticalLayout.addWidget(self.label_2) - self.startFreqSpinBox = QtGui.QDoubleSpinBox(self.groupBox) + self.startFreqSpinBox = QtGui.QDoubleSpinBox(self.frequencyDockWidgetContents) self.startFreqSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.startFreqSpinBox.setDecimals(3) self.startFreqSpinBox.setMinimum(24.0) @@ -101,10 +115,10 @@ class Ui_QSpectrumAnalyzerMainWindow(object): self.startFreqSpinBox.setProperty("value", 87.0) self.startFreqSpinBox.setObjectName(_fromUtf8("startFreqSpinBox")) self.verticalLayout.addWidget(self.startFreqSpinBox) - self.label_3 = QtGui.QLabel(self.groupBox) + self.label_3 = QtGui.QLabel(self.frequencyDockWidgetContents) self.label_3.setObjectName(_fromUtf8("label_3")) self.verticalLayout.addWidget(self.label_3) - self.stopFreqSpinBox = QtGui.QDoubleSpinBox(self.groupBox) + self.stopFreqSpinBox = QtGui.QDoubleSpinBox(self.frequencyDockWidgetContents) self.stopFreqSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.stopFreqSpinBox.setDecimals(3) self.stopFreqSpinBox.setMinimum(24.0) @@ -112,72 +126,103 @@ class Ui_QSpectrumAnalyzerMainWindow(object): self.stopFreqSpinBox.setProperty("value", 108.0) self.stopFreqSpinBox.setObjectName(_fromUtf8("stopFreqSpinBox")) self.verticalLayout.addWidget(self.stopFreqSpinBox) - self.label = QtGui.QLabel(self.groupBox) + self.label = QtGui.QLabel(self.frequencyDockWidgetContents) self.label.setObjectName(_fromUtf8("label")) self.verticalLayout.addWidget(self.label) - self.binSizeSpinBox = QtGui.QDoubleSpinBox(self.groupBox) + self.binSizeSpinBox = QtGui.QDoubleSpinBox(self.frequencyDockWidgetContents) self.binSizeSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.binSizeSpinBox.setDecimals(3) self.binSizeSpinBox.setMaximum(2800.0) self.binSizeSpinBox.setProperty("value", 10.0) self.binSizeSpinBox.setObjectName(_fromUtf8("binSizeSpinBox")) self.verticalLayout.addWidget(self.binSizeSpinBox) - self.verticalLayout_3.addWidget(self.groupBox) - self.groupBox_3 = QtGui.QGroupBox(self.dockWidgetContents) - self.groupBox_3.setObjectName(_fromUtf8("groupBox_3")) - self.gridLayout_2 = QtGui.QGridLayout(self.groupBox_3) - self.gridLayout_2.setObjectName(_fromUtf8("gridLayout_2")) - self.label_4 = QtGui.QLabel(self.groupBox_3) - self.label_4.setObjectName(_fromUtf8("label_4")) - self.gridLayout_2.addWidget(self.label_4, 0, 0, 1, 1) - self.label_6 = QtGui.QLabel(self.groupBox_3) - self.label_6.setObjectName(_fromUtf8("label_6")) - self.gridLayout_2.addWidget(self.label_6, 0, 1, 1, 1) - self.gainSpinBox = QtGui.QSpinBox(self.groupBox_3) + spacerItem1 = QtGui.QSpacerItem(20, 0, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout.addItem(spacerItem1) + self.frequencyDockWidget.setWidget(self.frequencyDockWidgetContents) + QSpectrumAnalyzerMainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.frequencyDockWidget) + self.settingsDockWidget = QtGui.QDockWidget(QSpectrumAnalyzerMainWindow) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.settingsDockWidget.sizePolicy().hasHeightForWidth()) + self.settingsDockWidget.setSizePolicy(sizePolicy) + self.settingsDockWidget.setFeatures(QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetMovable) + self.settingsDockWidget.setObjectName(_fromUtf8("settingsDockWidget")) + self.settingsDockWidgetContents = QtGui.QWidget() + self.settingsDockWidgetContents.setObjectName(_fromUtf8("settingsDockWidgetContents")) + self.gridLayout = QtGui.QGridLayout(self.settingsDockWidgetContents) + self.gridLayout.setObjectName(_fromUtf8("gridLayout")) + self.smoothCheckBox = QtGui.QCheckBox(self.settingsDockWidgetContents) + self.smoothCheckBox.setObjectName(_fromUtf8("smoothCheckBox")) + self.gridLayout.addWidget(self.smoothCheckBox, 5, 0, 1, 2) + self.label_5 = QtGui.QLabel(self.settingsDockWidgetContents) + self.label_5.setObjectName(_fromUtf8("label_5")) + self.gridLayout.addWidget(self.label_5, 2, 0, 1, 1) + self.peakHoldCheckBox = QtGui.QCheckBox(self.settingsDockWidgetContents) + self.peakHoldCheckBox.setObjectName(_fromUtf8("peakHoldCheckBox")) + self.gridLayout.addWidget(self.peakHoldCheckBox, 4, 0, 1, 3) + spacerItem2 = QtGui.QSpacerItem(20, 1, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem2, 6, 0, 1, 1) + self.intervalSpinBox = QtGui.QDoubleSpinBox(self.settingsDockWidgetContents) + self.intervalSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) + self.intervalSpinBox.setMaximum(999.0) + self.intervalSpinBox.setProperty("value", 1.0) + self.intervalSpinBox.setObjectName(_fromUtf8("intervalSpinBox")) + self.gridLayout.addWidget(self.intervalSpinBox, 1, 0, 1, 1) + self.smoothButton = QtGui.QToolButton(self.settingsDockWidgetContents) + self.smoothButton.setAutoRaise(False) + self.smoothButton.setObjectName(_fromUtf8("smoothButton")) + self.gridLayout.addWidget(self.smoothButton, 5, 2, 1, 1) + self.gainSpinBox = QtGui.QSpinBox(self.settingsDockWidgetContents) self.gainSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.gainSpinBox.setMinimum(-1) self.gainSpinBox.setMaximum(49) self.gainSpinBox.setProperty("value", -1) self.gainSpinBox.setObjectName(_fromUtf8("gainSpinBox")) - self.gridLayout_2.addWidget(self.gainSpinBox, 1, 1, 1, 1) - self.label_5 = QtGui.QLabel(self.groupBox_3) - self.label_5.setObjectName(_fromUtf8("label_5")) - self.gridLayout_2.addWidget(self.label_5, 2, 0, 1, 1) - self.label_7 = QtGui.QLabel(self.groupBox_3) + self.gridLayout.addWidget(self.gainSpinBox, 1, 1, 1, 2) + self.label_7 = QtGui.QLabel(self.settingsDockWidgetContents) self.label_7.setObjectName(_fromUtf8("label_7")) - self.gridLayout_2.addWidget(self.label_7, 2, 1, 1, 1) - self.ppmSpinBox = QtGui.QSpinBox(self.groupBox_3) + self.gridLayout.addWidget(self.label_7, 2, 1, 1, 2) + self.ppmSpinBox = QtGui.QSpinBox(self.settingsDockWidgetContents) self.ppmSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.ppmSpinBox.setMinimum(-999) self.ppmSpinBox.setMaximum(999) self.ppmSpinBox.setObjectName(_fromUtf8("ppmSpinBox")) - self.gridLayout_2.addWidget(self.ppmSpinBox, 3, 0, 1, 1) - self.cropSpinBox = QtGui.QSpinBox(self.groupBox_3) + self.gridLayout.addWidget(self.ppmSpinBox, 3, 0, 1, 1) + self.label_6 = QtGui.QLabel(self.settingsDockWidgetContents) + self.label_6.setObjectName(_fromUtf8("label_6")) + self.gridLayout.addWidget(self.label_6, 0, 1, 1, 2) + self.cropSpinBox = QtGui.QSpinBox(self.settingsDockWidgetContents) self.cropSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) self.cropSpinBox.setObjectName(_fromUtf8("cropSpinBox")) - self.gridLayout_2.addWidget(self.cropSpinBox, 3, 1, 1, 1) - self.intervalSpinBox = QtGui.QDoubleSpinBox(self.groupBox_3) - self.intervalSpinBox.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.intervalSpinBox.setMaximum(999.0) - self.intervalSpinBox.setProperty("value", 1.0) - self.intervalSpinBox.setObjectName(_fromUtf8("intervalSpinBox")) - self.gridLayout_2.addWidget(self.intervalSpinBox, 1, 0, 1, 1) - self.verticalLayout_3.addWidget(self.groupBox_3) - self.groupBox_4 = QtGui.QGroupBox(self.dockWidgetContents) - self.groupBox_4.setObjectName(_fromUtf8("groupBox_4")) - self.verticalLayout_2 = QtGui.QVBoxLayout(self.groupBox_4) - self.verticalLayout_2.setObjectName(_fromUtf8("verticalLayout_2")) - self.histogramPlotLayout = GraphicsLayoutWidget(self.groupBox_4) + self.gridLayout.addWidget(self.cropSpinBox, 3, 1, 1, 2) + self.label_4 = QtGui.QLabel(self.settingsDockWidgetContents) + self.label_4.setObjectName(_fromUtf8("label_4")) + self.gridLayout.addWidget(self.label_4, 0, 0, 1, 1) + self.settingsDockWidget.setWidget(self.settingsDockWidgetContents) + QSpectrumAnalyzerMainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.settingsDockWidget) + self.levelsDockWidget = QtGui.QDockWidget(QSpectrumAnalyzerMainWindow) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.levelsDockWidget.sizePolicy().hasHeightForWidth()) + self.levelsDockWidget.setSizePolicy(sizePolicy) + self.levelsDockWidget.setFeatures(QtGui.QDockWidget.DockWidgetFloatable|QtGui.QDockWidget.DockWidgetMovable) + self.levelsDockWidget.setObjectName(_fromUtf8("levelsDockWidget")) + self.levelsDockWidgetContents = QtGui.QWidget() + self.levelsDockWidgetContents.setObjectName(_fromUtf8("levelsDockWidgetContents")) + self.verticalLayout_6 = QtGui.QVBoxLayout(self.levelsDockWidgetContents) + self.verticalLayout_6.setObjectName(_fromUtf8("verticalLayout_6")) + self.histogramPlotLayout = GraphicsLayoutWidget(self.levelsDockWidgetContents) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.histogramPlotLayout.sizePolicy().hasHeightForWidth()) self.histogramPlotLayout.setSizePolicy(sizePolicy) self.histogramPlotLayout.setObjectName(_fromUtf8("histogramPlotLayout")) - self.verticalLayout_2.addWidget(self.histogramPlotLayout) - self.verticalLayout_3.addWidget(self.groupBox_4) - self.dockWidget.setWidget(self.dockWidgetContents) - QSpectrumAnalyzerMainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.dockWidget) + self.verticalLayout_6.addWidget(self.histogramPlotLayout) + self.levelsDockWidget.setWidget(self.levelsDockWidgetContents) + QSpectrumAnalyzerMainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(2), self.levelsDockWidget) self.action_Settings = QtGui.QAction(QSpectrumAnalyzerMainWindow) self.action_Settings.setObjectName(_fromUtf8("action_Settings")) self.action_Quit = QtGui.QAction(QSpectrumAnalyzerMainWindow) @@ -193,10 +238,10 @@ class Ui_QSpectrumAnalyzerMainWindow(object): self.label_2.setBuddy(self.startFreqSpinBox) self.label_3.setBuddy(self.stopFreqSpinBox) self.label.setBuddy(self.binSizeSpinBox) - self.label_4.setBuddy(self.intervalSpinBox) - self.label_6.setBuddy(self.gainSpinBox) self.label_5.setBuddy(self.ppmSpinBox) self.label_7.setBuddy(self.cropSpinBox) + self.label_6.setBuddy(self.gainSpinBox) + self.label_4.setBuddy(self.intervalSpinBox) self.retranslateUi(QSpectrumAnalyzerMainWindow) QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerMainWindow) @@ -209,7 +254,10 @@ class Ui_QSpectrumAnalyzerMainWindow(object): QSpectrumAnalyzerMainWindow.setTabOrder(self.intervalSpinBox, self.gainSpinBox) QSpectrumAnalyzerMainWindow.setTabOrder(self.gainSpinBox, self.ppmSpinBox) QSpectrumAnalyzerMainWindow.setTabOrder(self.ppmSpinBox, self.cropSpinBox) - QSpectrumAnalyzerMainWindow.setTabOrder(self.cropSpinBox, self.histogramPlotLayout) + QSpectrumAnalyzerMainWindow.setTabOrder(self.cropSpinBox, self.peakHoldCheckBox) + QSpectrumAnalyzerMainWindow.setTabOrder(self.peakHoldCheckBox, self.smoothCheckBox) + QSpectrumAnalyzerMainWindow.setTabOrder(self.smoothCheckBox, self.smoothButton) + QSpectrumAnalyzerMainWindow.setTabOrder(self.smoothButton, self.histogramPlotLayout) QSpectrumAnalyzerMainWindow.setTabOrder(self.histogramPlotLayout, self.mainPlotLayout) QSpectrumAnalyzerMainWindow.setTabOrder(self.mainPlotLayout, self.waterfallPlotLayout) @@ -217,24 +265,27 @@ class Ui_QSpectrumAnalyzerMainWindow(object): QSpectrumAnalyzerMainWindow.setWindowTitle(_translate("QSpectrumAnalyzerMainWindow", "QSpectrumAnalyzer", None)) self.menu_File.setTitle(_translate("QSpectrumAnalyzerMainWindow", "&File", None)) self.menu_Help.setTitle(_translate("QSpectrumAnalyzerMainWindow", "&Help", None)) - self.groupBox_2.setTitle(_translate("QSpectrumAnalyzerMainWindow", "Controls", None)) + self.controlsDockWidget.setWindowTitle(_translate("QSpectrumAnalyzerMainWindow", "Controls", None)) self.startButton.setText(_translate("QSpectrumAnalyzerMainWindow", "&Start", None)) self.stopButton.setText(_translate("QSpectrumAnalyzerMainWindow", "S&top", None)) self.singleShotButton.setText(_translate("QSpectrumAnalyzerMainWindow", "Si&ngle shot", None)) - self.groupBox.setTitle(_translate("QSpectrumAnalyzerMainWindow", "Frequency", None)) + self.frequencyDockWidget.setWindowTitle(_translate("QSpectrumAnalyzerMainWindow", "Frequency", None)) self.label_2.setText(_translate("QSpectrumAnalyzerMainWindow", "Start:", None)) self.startFreqSpinBox.setSuffix(_translate("QSpectrumAnalyzerMainWindow", " MHz", None)) self.label_3.setText(_translate("QSpectrumAnalyzerMainWindow", "Stop:", None)) self.stopFreqSpinBox.setSuffix(_translate("QSpectrumAnalyzerMainWindow", " MHz", None)) self.label.setText(_translate("QSpectrumAnalyzerMainWindow", "Bin size:", None)) self.binSizeSpinBox.setSuffix(_translate("QSpectrumAnalyzerMainWindow", " kHz", None)) - self.groupBox_3.setTitle(_translate("QSpectrumAnalyzerMainWindow", "Settings", None)) - self.label_4.setText(_translate("QSpectrumAnalyzerMainWindow", "Interval [s]:", None)) - self.label_6.setText(_translate("QSpectrumAnalyzerMainWindow", "Gain [dB]:", None)) - self.gainSpinBox.setSpecialValueText(_translate("QSpectrumAnalyzerMainWindow", "auto", None)) + self.settingsDockWidget.setWindowTitle(_translate("QSpectrumAnalyzerMainWindow", "Settings", None)) + self.smoothCheckBox.setText(_translate("QSpectrumAnalyzerMainWindow", "Smoothing", None)) self.label_5.setText(_translate("QSpectrumAnalyzerMainWindow", "Corr. [ppm]:", None)) + self.peakHoldCheckBox.setText(_translate("QSpectrumAnalyzerMainWindow", "Peak hold", None)) + self.smoothButton.setText(_translate("QSpectrumAnalyzerMainWindow", "...", None)) + self.gainSpinBox.setSpecialValueText(_translate("QSpectrumAnalyzerMainWindow", "auto", None)) self.label_7.setText(_translate("QSpectrumAnalyzerMainWindow", "Crop [%]:", None)) - self.groupBox_4.setTitle(_translate("QSpectrumAnalyzerMainWindow", "Levels", None)) + self.label_6.setText(_translate("QSpectrumAnalyzerMainWindow", "Gain [dB]:", None)) + self.label_4.setText(_translate("QSpectrumAnalyzerMainWindow", "Interval [s]:", None)) + self.levelsDockWidget.setWindowTitle(_translate("QSpectrumAnalyzerMainWindow", "Levels", None)) self.action_Settings.setText(_translate("QSpectrumAnalyzerMainWindow", "&Settings...", None)) self.action_Quit.setText(_translate("QSpectrumAnalyzerMainWindow", "&Quit", None)) self.action_Quit.setShortcut(_translate("QSpectrumAnalyzerMainWindow", "Ctrl+Q", None)) diff --git a/qspectrumanalyzer/ui_qspectrumanalyzer_settings.py b/qspectrumanalyzer/ui_qspectrumanalyzer_settings.py index 6f5a554..dd6bf7e 100644 --- a/qspectrumanalyzer/ui_qspectrumanalyzer_settings.py +++ b/qspectrumanalyzer/ui_qspectrumanalyzer_settings.py @@ -25,7 +25,7 @@ except AttributeError: class Ui_QSpectrumAnalyzerSettings(object): def setupUi(self, QSpectrumAnalyzerSettings): QSpectrumAnalyzerSettings.setObjectName(_fromUtf8("QSpectrumAnalyzerSettings")) - QSpectrumAnalyzerSettings.resize(350, 210) + QSpectrumAnalyzerSettings.resize(400, 210) self.verticalLayout = QtGui.QVBoxLayout(QSpectrumAnalyzerSettings) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.formLayout = QtGui.QFormLayout() @@ -77,23 +77,28 @@ class Ui_QSpectrumAnalyzerSettings(object): self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) self.buttonBox.setObjectName(_fromUtf8("buttonBox")) self.verticalLayout.addWidget(self.buttonBox) + self.label_3.setBuddy(self.backendComboBox) + self.label.setBuddy(self.executableEdit) + self.label_2.setBuddy(self.waterfallHistorySizeSpinBox) + self.label_4.setBuddy(self.sampleRateSpinBox) self.retranslateUi(QSpectrumAnalyzerSettings) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), QSpectrumAnalyzerSettings.accept) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), QSpectrumAnalyzerSettings.reject) QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerSettings) + QSpectrumAnalyzerSettings.setTabOrder(self.backendComboBox, self.executableEdit) QSpectrumAnalyzerSettings.setTabOrder(self.executableEdit, self.executableButton) QSpectrumAnalyzerSettings.setTabOrder(self.executableButton, self.waterfallHistorySizeSpinBox) - QSpectrumAnalyzerSettings.setTabOrder(self.waterfallHistorySizeSpinBox, self.buttonBox) + QSpectrumAnalyzerSettings.setTabOrder(self.waterfallHistorySizeSpinBox, self.sampleRateSpinBox) def retranslateUi(self, QSpectrumAnalyzerSettings): - QSpectrumAnalyzerSettings.setWindowTitle(_translate("QSpectrumAnalyzerSettings", "QSpectrumAnalyzer - Settings", None)) - self.label_3.setText(_translate("QSpectrumAnalyzerSettings", "Backend:", None)) + QSpectrumAnalyzerSettings.setWindowTitle(_translate("QSpectrumAnalyzerSettings", "Settings - QSpectrumAnalyzer", None)) + self.label_3.setText(_translate("QSpectrumAnalyzerSettings", "&Backend:", None)) self.backendComboBox.setItemText(0, _translate("QSpectrumAnalyzerSettings", "rtl_power", None)) self.backendComboBox.setItemText(1, _translate("QSpectrumAnalyzerSettings", "rtl_power_fftw", None)) - self.label.setText(_translate("QSpectrumAnalyzerSettings", "Executable:", None)) + self.label.setText(_translate("QSpectrumAnalyzerSettings", "E&xecutable:", None)) self.executableEdit.setText(_translate("QSpectrumAnalyzerSettings", "rtl_power", None)) self.executableButton.setText(_translate("QSpectrumAnalyzerSettings", "...", None)) - self.label_2.setText(_translate("QSpectrumAnalyzerSettings", "Waterfall history size:", None)) - self.label_4.setText(_translate("QSpectrumAnalyzerSettings", "Sample rate:", None)) + self.label_2.setText(_translate("QSpectrumAnalyzerSettings", "&Waterfall history size:", None)) + self.label_4.setText(_translate("QSpectrumAnalyzerSettings", "Sa&mple rate:", None)) diff --git a/qspectrumanalyzer/ui_qspectrumanalyzer_smooth.py b/qspectrumanalyzer/ui_qspectrumanalyzer_smooth.py new file mode 100644 index 0000000..031a14a --- /dev/null +++ b/qspectrumanalyzer/ui_qspectrumanalyzer_smooth.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'qspectrumanalyzer/qspectrumanalyzer_smooth.ui' +# +# Created by: PyQt4 UI code generator 4.11.4 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +try: + _fromUtf8 = QtCore.QString.fromUtf8 +except AttributeError: + def _fromUtf8(s): + return s + +try: + _encoding = QtGui.QApplication.UnicodeUTF8 + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig, _encoding) +except AttributeError: + def _translate(context, text, disambig): + return QtGui.QApplication.translate(context, text, disambig) + +class Ui_QSpectrumAnalyzerSmooth(object): + def setupUi(self, QSpectrumAnalyzerSmooth): + QSpectrumAnalyzerSmooth.setObjectName(_fromUtf8("QSpectrumAnalyzerSmooth")) + QSpectrumAnalyzerSmooth.resize(250, 130) + self.verticalLayout = QtGui.QVBoxLayout(QSpectrumAnalyzerSmooth) + self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) + self.formLayout = QtGui.QFormLayout() + self.formLayout.setObjectName(_fromUtf8("formLayout")) + self.label = QtGui.QLabel(QSpectrumAnalyzerSmooth) + self.label.setObjectName(_fromUtf8("label")) + self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.label) + self.windowFunctionComboBox = QtGui.QComboBox(QSpectrumAnalyzerSmooth) + self.windowFunctionComboBox.setObjectName(_fromUtf8("windowFunctionComboBox")) + self.windowFunctionComboBox.addItem(_fromUtf8("")) + self.windowFunctionComboBox.addItem(_fromUtf8("")) + self.windowFunctionComboBox.addItem(_fromUtf8("")) + self.windowFunctionComboBox.addItem(_fromUtf8("")) + self.windowFunctionComboBox.addItem(_fromUtf8("")) + self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.windowFunctionComboBox) + self.label_2 = QtGui.QLabel(QSpectrumAnalyzerSmooth) + self.label_2.setObjectName(_fromUtf8("label_2")) + self.formLayout.setWidget(1, QtGui.QFormLayout.LabelRole, self.label_2) + self.windowLengthSpinBox = QtGui.QSpinBox(QSpectrumAnalyzerSmooth) + self.windowLengthSpinBox.setMinimum(3) + self.windowLengthSpinBox.setMaximum(1001) + self.windowLengthSpinBox.setProperty("value", 11) + self.windowLengthSpinBox.setObjectName(_fromUtf8("windowLengthSpinBox")) + self.formLayout.setWidget(1, QtGui.QFormLayout.FieldRole, self.windowLengthSpinBox) + self.verticalLayout.addLayout(self.formLayout) + spacerItem = QtGui.QSpacerItem(20, 1, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.verticalLayout.addItem(spacerItem) + self.buttonBox = QtGui.QDialogButtonBox(QSpectrumAnalyzerSmooth) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok) + self.buttonBox.setObjectName(_fromUtf8("buttonBox")) + self.verticalLayout.addWidget(self.buttonBox) + self.label.setBuddy(self.windowFunctionComboBox) + self.label_2.setBuddy(self.windowLengthSpinBox) + + self.retranslateUi(QSpectrumAnalyzerSmooth) + self.windowFunctionComboBox.setCurrentIndex(0) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), QSpectrumAnalyzerSmooth.accept) + QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), QSpectrumAnalyzerSmooth.reject) + QtCore.QMetaObject.connectSlotsByName(QSpectrumAnalyzerSmooth) + + def retranslateUi(self, QSpectrumAnalyzerSmooth): + QSpectrumAnalyzerSmooth.setWindowTitle(_translate("QSpectrumAnalyzerSmooth", "Smoothing - QSpectrumAnalyzer", None)) + self.label.setText(_translate("QSpectrumAnalyzerSmooth", "&Window function:", None)) + self.windowFunctionComboBox.setItemText(0, _translate("QSpectrumAnalyzerSmooth", "rectangular", None)) + self.windowFunctionComboBox.setItemText(1, _translate("QSpectrumAnalyzerSmooth", "hanning", None)) + self.windowFunctionComboBox.setItemText(2, _translate("QSpectrumAnalyzerSmooth", "hamming", None)) + self.windowFunctionComboBox.setItemText(3, _translate("QSpectrumAnalyzerSmooth", "bartlett", None)) + self.windowFunctionComboBox.setItemText(4, _translate("QSpectrumAnalyzerSmooth", "blackman", None)) + self.label_2.setText(_translate("QSpectrumAnalyzerSmooth", "Window len>h:", None)) +