kopia lustrzana https://github.com/NanoVNA-Saver/nanovna-saver
fix: PyQt6 fixes (#629)
More fixes for PyQt6 should now be usable again with >python3.7 & PyQt6 Calibration - tested Display Configuration - testedpull/634/head
rodzic
d09b55e1ae
commit
8f86722c1e
|
@ -502,7 +502,7 @@ class FrequencyChart(Chart):
|
|||
and (not self.reference or self._data_oob(self.reference))
|
||||
):
|
||||
# Data outside frequency range
|
||||
qp.setBackgroundMode(Qt.OpaqueMode)
|
||||
qp.setBackgroundMode(Qt.BGMode.OpaqueMode)
|
||||
qp.setBackground(Chart.color.background)
|
||||
qp.setPen(Chart.color.text)
|
||||
qp.drawText(
|
||||
|
@ -512,7 +512,7 @@ class FrequencyChart(Chart):
|
|||
)
|
||||
|
||||
def drawDragbog(self, qp: QtGui.QPainter):
|
||||
dashed_pen = QtGui.QPen(Chart.color.foreground, 1, Qt.DashLine)
|
||||
dashed_pen = QtGui.QPen(Chart.color.foreground, 1, Qt.PenStyle.DashLine)
|
||||
qp.setPen(dashed_pen)
|
||||
top_left = QtCore.QPoint(
|
||||
self.dragbox.pos_start[0], self.dragbox.pos_start[1]
|
||||
|
|
|
@ -479,7 +479,7 @@ class TDRChart(Chart):
|
|||
self._draw_graph(height, width)
|
||||
|
||||
if self.dragbox.state and self.dragbox.pos[0] != -1:
|
||||
dashed_pen = QPen(Chart.color.foreground, 1, Qt.DashLine)
|
||||
dashed_pen = QPen(Chart.color.foreground, 1, Qt.PenStyle.DashLine)
|
||||
qp.setPen(dashed_pen)
|
||||
qp.drawRect(
|
||||
QRect(
|
||||
|
|
|
@ -91,7 +91,7 @@ class NanoVNA(VNA):
|
|||
rgba_array,
|
||||
self.screenwidth,
|
||||
self.screenheight,
|
||||
QImage.Format_ARGB32,
|
||||
QImage.Format.Format_ARGB32,
|
||||
)
|
||||
logger.debug("Captured screenshot")
|
||||
return QPixmap(image)
|
||||
|
|
|
@ -304,7 +304,7 @@ class NanoVNASaver(QWidget):
|
|||
self.marker_data_layout.addWidget(m.get_data_layout())
|
||||
|
||||
scroll2 = QtWidgets.QScrollArea()
|
||||
# scroll2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
|
||||
# scroll2.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarPolicy.ScrollBarAlwaysOn)
|
||||
scroll2.setWidgetResizable(True)
|
||||
scroll2.setVisible(True)
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class BandsModel(QtCore.QAbstractTableModel):
|
|||
def setData(
|
||||
self, index: QModelIndex, value: typing.Any, role: int = ...
|
||||
) -> bool:
|
||||
if role == QtCore.Qt.EditRole and index.isValid():
|
||||
if role == QtCore.Qt.ItemDataRole.EditRole and index.isValid():
|
||||
t = self.bands[index.row()]
|
||||
name = t[0]
|
||||
start = t[1]
|
||||
|
|
|
@ -63,10 +63,10 @@ class BandsWindow(QtWidgets.QWidget):
|
|||
|
||||
def resetBands(self):
|
||||
confirm = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Warning,
|
||||
QtWidgets.QMessageBox.Icon.Warning,
|
||||
"Confirm reset",
|
||||
"Are you sure you want to reset the bands to default?",
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
).exec()
|
||||
if confirm == QtWidgets.QMessageBox.Yes:
|
||||
if confirm == QtWidgets.QMessageBox.StandardButton.Yes:
|
||||
self.app.bands.resetBands()
|
||||
|
|
|
@ -282,11 +282,11 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
"If you are certain you know what you are doing, click"
|
||||
" Yes."
|
||||
),
|
||||
QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
)
|
||||
|
||||
if response == QtWidgets.QMessageBox.Yes:
|
||||
if response == QtWidgets.QMessageBox.StandardButton.Yes:
|
||||
self.app.settings.setValue("ExpertCalibrationUser", True)
|
||||
return True
|
||||
return False
|
||||
|
@ -677,7 +677,7 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
filedialog = QtWidgets.QFileDialog(self)
|
||||
filedialog.setDefaultSuffix("cal")
|
||||
filedialog.setNameFilter("Calibration Files (*.cal);;All files (*.*)")
|
||||
filedialog.setAcceptMode(QtWidgets.QFileDialog.AcceptSave)
|
||||
filedialog.setAcceptMode(QtWidgets.QFileDialog.AcceptMode.AcceptSave)
|
||||
if filedialog.exec():
|
||||
filename = filedialog.selectedFiles()[0]
|
||||
else:
|
||||
|
@ -707,7 +707,7 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
def automaticCalibration(self):
|
||||
self.btn_automatic.setDisabled(True)
|
||||
introduction = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"Calibration assistant",
|
||||
(
|
||||
"This calibration assistant will help you create a calibration"
|
||||
|
@ -723,16 +723,16 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
" to save slot 0 before starting.</b><br><br>"
|
||||
"Once you are ready to proceed, press Ok."
|
||||
),
|
||||
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
)
|
||||
response = introduction.exec()
|
||||
if response != QtWidgets.QMessageBox.Ok:
|
||||
if response != QtWidgets.QMessageBox.StandardButton.Ok:
|
||||
self.btn_automatic.setDisabled(False)
|
||||
return
|
||||
logger.info("Starting automatic calibration assistant.")
|
||||
if not self.app.vna.connected():
|
||||
QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"NanoVNA not connected",
|
||||
(
|
||||
"Please ensure the NanoVNA is connected before attempting"
|
||||
|
@ -744,7 +744,7 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
|
||||
if self.app.sweep.properties.mode == SweepMode.CONTINOUS:
|
||||
QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"Continuous sweep enabled",
|
||||
(
|
||||
"Please disable continuous sweeping before attempting"
|
||||
|
@ -755,18 +755,18 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
return
|
||||
|
||||
short_step = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"Calibrate short",
|
||||
(
|
||||
'Please connect the "short" standard to port 0 of the'
|
||||
" NanoVNA.\n\n"
|
||||
"Press Ok when you are ready to continue."
|
||||
),
|
||||
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
)
|
||||
|
||||
response = short_step.exec()
|
||||
if response != QtWidgets.QMessageBox.Ok:
|
||||
if response != QtWidgets.QMessageBox.StandardButton.Ok:
|
||||
self.btn_automatic.setDisabled(False)
|
||||
return
|
||||
self.reset()
|
||||
|
@ -789,7 +789,7 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
self.nextStep = 1
|
||||
|
||||
open_step = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"Calibrate open",
|
||||
(
|
||||
'Please connect the "open" standard to port 0 of the'
|
||||
|
@ -798,11 +798,11 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
" cable unconnected if desired.\n\n"
|
||||
"Press Ok when you are ready to continue."
|
||||
),
|
||||
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
)
|
||||
|
||||
response = open_step.exec()
|
||||
if response != QtWidgets.QMessageBox.Ok:
|
||||
if response != QtWidgets.QMessageBox.StandardButton.Ok:
|
||||
self.nextStep = -1
|
||||
self.btn_automatic.setDisabled(False)
|
||||
self.app.worker.signals.finished.disconnect(
|
||||
|
@ -817,18 +817,18 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
self.cal_save("open")
|
||||
self.nextStep = 2
|
||||
load_step = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"Calibrate load",
|
||||
(
|
||||
'Please connect the "load" standard to port 0 of the'
|
||||
" NanoVNA.\n\n"
|
||||
"Press Ok when you are ready to continue."
|
||||
),
|
||||
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
)
|
||||
|
||||
response = load_step.exec()
|
||||
if response != QtWidgets.QMessageBox.Ok:
|
||||
if response != QtWidgets.QMessageBox.StandardButton.Ok:
|
||||
self.btn_automatic.setDisabled(False)
|
||||
self.nextStep = -1
|
||||
self.app.worker.signals.finished.disconnect(
|
||||
|
@ -843,7 +843,7 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
self.cal_save("load")
|
||||
self.nextStep = 3
|
||||
continue_step = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"1-port calibration complete",
|
||||
(
|
||||
"The required steps for a 1-port calibration are now"
|
||||
|
@ -852,13 +852,13 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
' press "Yes". To apply the 1-port calibration and stop,'
|
||||
' press "Apply"'
|
||||
),
|
||||
QtWidgets.QMessageBox.Yes
|
||||
| QtWidgets.QMessageBox.Apply
|
||||
| QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Yes
|
||||
| QtWidgets.QMessageBox.StandardButton.Apply
|
||||
| QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
)
|
||||
|
||||
response = continue_step.exec()
|
||||
if response == QtWidgets.QMessageBox.Apply:
|
||||
if response == QtWidgets.QMessageBox.StandardButton.Apply:
|
||||
self.calculate()
|
||||
self.nextStep = -1
|
||||
self.app.worker.signals.finished.disconnect(
|
||||
|
@ -866,7 +866,7 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
)
|
||||
self.btn_automatic.setDisabled(False)
|
||||
return
|
||||
if response != QtWidgets.QMessageBox.Yes:
|
||||
if response != QtWidgets.QMessageBox.StandardButton.Yes:
|
||||
self.btn_automatic.setDisabled(False)
|
||||
self.nextStep = -1
|
||||
self.app.worker.signals.finished.disconnect(
|
||||
|
@ -875,7 +875,7 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
return
|
||||
|
||||
isolation_step = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"Calibrate isolation",
|
||||
(
|
||||
'Please connect the "load" standard to port 1 of the'
|
||||
|
@ -884,11 +884,11 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
" port 0.\n\n"
|
||||
"Press Ok when you are ready to continue."
|
||||
),
|
||||
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
)
|
||||
|
||||
response = isolation_step.exec()
|
||||
if response != QtWidgets.QMessageBox.Ok:
|
||||
if response != QtWidgets.QMessageBox.StandardButton.Ok:
|
||||
self.btn_automatic.setDisabled(False)
|
||||
self.nextStep = -1
|
||||
self.app.worker.signals.finished.disconnect(
|
||||
|
@ -903,18 +903,18 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
self.cal_save("isolation")
|
||||
self.nextStep = 4
|
||||
through_step = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"Calibrate through",
|
||||
(
|
||||
'Please connect the "through" standard between'
|
||||
" port 0 and port 1 of the NanoVNA.\n\n"
|
||||
"Press Ok when you are ready to continue."
|
||||
),
|
||||
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
)
|
||||
|
||||
response = through_step.exec()
|
||||
if response != QtWidgets.QMessageBox.Ok:
|
||||
if response != QtWidgets.QMessageBox.StandardButton.Ok:
|
||||
self.btn_automatic.setDisabled(False)
|
||||
self.nextStep = -1
|
||||
self.app.worker.signals.finished.disconnect(
|
||||
|
@ -929,17 +929,17 @@ class CalibrationWindow(QtWidgets.QWidget):
|
|||
self.cal_save("thrurefl")
|
||||
self.cal_save("through")
|
||||
apply_step = QtWidgets.QMessageBox(
|
||||
QtWidgets.QMessageBox.Information,
|
||||
QtWidgets.QMessageBox.Icon.Information,
|
||||
"Calibrate complete",
|
||||
(
|
||||
"The calibration process is now complete. Press"
|
||||
' "Apply" to apply the calibration parameters.'
|
||||
),
|
||||
QtWidgets.QMessageBox.Apply | QtWidgets.QMessageBox.Cancel,
|
||||
QtWidgets.QMessageBox.StandardButton.Apply | QtWidgets.QMessageBox.StandardButton.Cancel,
|
||||
)
|
||||
|
||||
response = apply_step.exec()
|
||||
if response != QtWidgets.QMessageBox.Apply:
|
||||
if response != QtWidgets.QMessageBox.StandardButton.Apply:
|
||||
self.btn_automatic.setDisabled(False)
|
||||
self.nextStep = -1
|
||||
self.app.worker.signals.finished.disconnect(
|
||||
|
|
|
@ -544,7 +544,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
|
|||
|
||||
color = getattr(Chart.color, attr)
|
||||
color = QtWidgets.QColorDialog.getColor(
|
||||
color, options=QtWidgets.QColorDialog.ShowAlphaChannel
|
||||
color, options=QtWidgets.QColorDialog.ColorDialogOption.ShowAlphaChannel
|
||||
)
|
||||
|
||||
if not color.isValid():
|
||||
|
@ -552,7 +552,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
|
|||
return
|
||||
|
||||
palette = sender.palette()
|
||||
palette.setColor(QPalette.ButtonText, color)
|
||||
palette.setColor(QPalette.ColorRole.ButtonText, color)
|
||||
sender.setPalette(palette)
|
||||
self.changeSetting(setting, color)
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ class FilesWindow(QtWidgets.QWidget):
|
|||
filedialog.setNameFilter(
|
||||
"Touchstone 2-Port Files (*.s2p);;All files (*.*)"
|
||||
)
|
||||
filedialog.setAcceptMode(QtWidgets.QFileDialog.AcceptSave)
|
||||
filedialog.setAcceptMode(QtWidgets.QFileDialog.AcceptMode.AcceptSave)
|
||||
selected = filedialog.exec()
|
||||
if not selected:
|
||||
return
|
||||
|
|
Ładowanie…
Reference in New Issue