kopia lustrzana https://github.com/erdewit/HiFiScan
Switch to PyQt6, fixes issue #7
rodzic
dfd571243e
commit
37f8e44444
|
@ -6,7 +6,7 @@ import signal
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from PySide6 import QtGui as qtgui, QtWidgets as qt
|
from PyQt6 import QtCore as qtcore, QtGui as qtgui, QtWidgets as qt
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pyqtgraph as pg
|
import pyqtgraph as pg
|
||||||
|
@ -196,7 +196,7 @@ class App(qt.QMainWindow):
|
||||||
self.refSpectrumPlot = pw.plot(pen=(255, 100, 0), stepMode='right')
|
self.refSpectrumPlot = pw.plot(pen=(255, 100, 0), stepMode='right')
|
||||||
self.spectrumPlot = pw.plot(pen=(0, 255, 255), stepMode='right')
|
self.spectrumPlot = pw.plot(pen=(0, 255, 255), stepMode='right')
|
||||||
self.spectrumPlot.curve.setCompositionMode(
|
self.spectrumPlot.curve.setCompositionMode(
|
||||||
qtgui.QPainter.CompositionMode_Plus)
|
qtgui.QPainter.CompositionMode.CompositionMode_Plus)
|
||||||
vbox.addWidget(pw)
|
vbox.addWidget(pw)
|
||||||
|
|
||||||
self.lo = pg.SpinBox(
|
self.lo = pg.SpinBox(
|
||||||
|
@ -240,7 +240,7 @@ class App(qt.QMainWindow):
|
||||||
topWidget = qt.QWidget()
|
topWidget = qt.QWidget()
|
||||||
vbox = qt.QVBoxLayout()
|
vbox = qt.QVBoxLayout()
|
||||||
topWidget.setLayout(vbox)
|
topWidget.setLayout(vbox)
|
||||||
splitter = qt.QSplitter(qtgui.Qt.Vertical)
|
splitter = qt.QSplitter(qtcore.Qt.Orientation.Vertical)
|
||||||
vbox.addWidget(splitter)
|
vbox.addWidget(splitter)
|
||||||
|
|
||||||
self.irPlotWidget = pw = pg.PlotWidget()
|
self.irPlotWidget = pw = pg.PlotWidget()
|
||||||
|
@ -337,14 +337,14 @@ class App(qt.QMainWindow):
|
||||||
cal = hifi.read_correction(path)
|
cal = hifi.read_correction(path)
|
||||||
if cal:
|
if cal:
|
||||||
self.calibration = cal
|
self.calibration = cal
|
||||||
calAction.setText(path)
|
calAction.setText(calTxt + path)
|
||||||
self.saveDir = Path(path).parent
|
self.saveDir = Path(path).parent
|
||||||
else:
|
else:
|
||||||
clearCalibration()
|
clearCalibration()
|
||||||
|
|
||||||
def clearCalibration():
|
def clearCalibration():
|
||||||
self.calibration = None
|
self.calibration = None
|
||||||
calAction.setText('None')
|
calAction.setText(calTxt + 'None')
|
||||||
|
|
||||||
def loadTarget():
|
def loadTarget():
|
||||||
path, _ = qt.QFileDialog.getOpenFileName(
|
path, _ = qt.QFileDialog.getOpenFileName(
|
||||||
|
@ -353,29 +353,31 @@ class App(qt.QMainWindow):
|
||||||
target = hifi.read_correction(path)
|
target = hifi.read_correction(path)
|
||||||
if target:
|
if target:
|
||||||
self.target = target
|
self.target = target
|
||||||
targetAction.setText(path)
|
targetAction.setText(targetTxt + path)
|
||||||
self.saveDir = Path(path).parent
|
self.saveDir = Path(path).parent
|
||||||
else:
|
else:
|
||||||
clearTarget()
|
clearTarget()
|
||||||
|
|
||||||
def clearTarget():
|
def clearTarget():
|
||||||
self.target = None
|
self.target = None
|
||||||
targetAction.setText('None')
|
targetAction.setText(targetTxt + 'None')
|
||||||
|
|
||||||
menuBar = qt.QMenuBar()
|
def correctionsPressed():
|
||||||
|
corr.popup(correctionsButton.mapToGlobal(qtcore.QPoint(0, 0)))
|
||||||
|
|
||||||
|
calTxt = 'Mic Calibration: '
|
||||||
|
targetTxt = 'Target Curve: '
|
||||||
corr = qt.QMenu('Corrections...')
|
corr = qt.QMenu('Corrections...')
|
||||||
corr.addSection('Mic Calibration')
|
calAction = corr.addAction(calTxt + 'None', loadCalibration)
|
||||||
corr.addAction('Load', loadCalibration)
|
corr.addAction('Load', loadCalibration)
|
||||||
corr.addAction('Clear', clearCalibration)
|
corr.addAction('Clear', clearCalibration)
|
||||||
corr.addSection('Current:')
|
|
||||||
calAction = corr.addAction('None')
|
|
||||||
corr.addSeparator()
|
corr.addSeparator()
|
||||||
corr.addSection('Target Curve')
|
targetAction = corr.addAction(targetTxt + 'None', loadTarget)
|
||||||
corr.addAction('Load', loadTarget)
|
corr.addAction('Load', loadTarget)
|
||||||
corr.addAction('Clear', clearTarget)
|
corr.addAction('Clear', clearTarget)
|
||||||
corr.addSection('Current:')
|
|
||||||
targetAction = corr.addAction('None')
|
correctionsButton = qt.QPushButton('Corrections...')
|
||||||
menuBar.addMenu(corr)
|
correctionsButton.pressed.connect(correctionsPressed)
|
||||||
|
|
||||||
screenshotButton = qt.QPushButton('Screenshot')
|
screenshotButton = qt.QPushButton('Screenshot')
|
||||||
screenshotButton.setShortcut('S')
|
screenshotButton.setShortcut('S')
|
||||||
|
@ -385,7 +387,7 @@ class App(qt.QMainWindow):
|
||||||
pauseButton = qt.QPushButton('Pause')
|
pauseButton = qt.QPushButton('Pause')
|
||||||
pauseButton.setShortcut('Space')
|
pauseButton.setShortcut('Space')
|
||||||
pauseButton.setToolTip('<Space>')
|
pauseButton.setToolTip('<Space>')
|
||||||
pauseButton.setFocusPolicy(qtgui.Qt.NoFocus)
|
pauseButton.setFocusPolicy(qtcore.Qt.FocusPolicy.NoFocus)
|
||||||
pauseButton.clicked.connect(self.setPaused)
|
pauseButton.clicked.connect(self.setPaused)
|
||||||
|
|
||||||
exitButton = qt.QPushButton('Exit')
|
exitButton = qt.QPushButton('Exit')
|
||||||
|
@ -398,7 +400,7 @@ class App(qt.QMainWindow):
|
||||||
hbox.addSpacing(16)
|
hbox.addSpacing(16)
|
||||||
hbox.addWidget(irButton)
|
hbox.addWidget(irButton)
|
||||||
hbox.addSpacing(64)
|
hbox.addSpacing(64)
|
||||||
hbox.addWidget(menuBar)
|
hbox.addWidget(correctionsButton)
|
||||||
hbox.addStretch(1)
|
hbox.addStretch(1)
|
||||||
hbox.addWidget(screenshotButton)
|
hbox.addWidget(screenshotButton)
|
||||||
hbox.addSpacing(32)
|
hbox.addSpacing(32)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -30,6 +30,6 @@ setup(
|
||||||
'gui_scripts': ['hifiscan=hifiscan.app:main']
|
'gui_scripts': ['hifiscan=hifiscan.app:main']
|
||||||
},
|
},
|
||||||
python_requires=">=3.8",
|
python_requires=">=3.8",
|
||||||
install_requires=['eventkit', 'numba', 'numpy', 'PySide6', 'pyqtgraph',
|
install_requires=['eventkit', 'numba', 'numpy', 'PyQt6', 'pyqtgraph',
|
||||||
'sounddevice']
|
'sounddevice']
|
||||||
)
|
)
|
||||||
|
|
Ładowanie…
Reference in New Issue