diff --git a/src/NanoVNASaver/Charts/Frequency.py b/src/NanoVNASaver/Charts/Frequency.py index 1599b3d..1d90c50 100644 --- a/src/NanoVNASaver/Charts/Frequency.py +++ b/src/NanoVNASaver/Charts/Frequency.py @@ -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] diff --git a/src/NanoVNASaver/Charts/TDR.py b/src/NanoVNASaver/Charts/TDR.py index d7878e2..0f8794c 100644 --- a/src/NanoVNASaver/Charts/TDR.py +++ b/src/NanoVNASaver/Charts/TDR.py @@ -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( diff --git a/src/NanoVNASaver/Hardware/NanoVNA.py b/src/NanoVNASaver/Hardware/NanoVNA.py index 1fd2250..906dbdb 100644 --- a/src/NanoVNASaver/Hardware/NanoVNA.py +++ b/src/NanoVNASaver/Hardware/NanoVNA.py @@ -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) diff --git a/src/NanoVNASaver/NanoVNASaver.py b/src/NanoVNASaver/NanoVNASaver.py index f79005c..2c3e588 100644 --- a/src/NanoVNASaver/NanoVNASaver.py +++ b/src/NanoVNASaver/NanoVNASaver.py @@ -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) diff --git a/src/NanoVNASaver/Settings/Bands.py b/src/NanoVNASaver/Settings/Bands.py index 9f74a04..8c8f1f7 100644 --- a/src/NanoVNASaver/Settings/Bands.py +++ b/src/NanoVNASaver/Settings/Bands.py @@ -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] diff --git a/src/NanoVNASaver/Windows/Bands.py b/src/NanoVNASaver/Windows/Bands.py index 1b8b9c0..ee6cdce 100644 --- a/src/NanoVNASaver/Windows/Bands.py +++ b/src/NanoVNASaver/Windows/Bands.py @@ -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() diff --git a/src/NanoVNASaver/Windows/CalibrationSettings.py b/src/NanoVNASaver/Windows/CalibrationSettings.py index 44266ae..6fde97a 100644 --- a/src/NanoVNASaver/Windows/CalibrationSettings.py +++ b/src/NanoVNASaver/Windows/CalibrationSettings.py @@ -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.

" "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( diff --git a/src/NanoVNASaver/Windows/DisplaySettings.py b/src/NanoVNASaver/Windows/DisplaySettings.py index 908d430..4e4befe 100644 --- a/src/NanoVNASaver/Windows/DisplaySettings.py +++ b/src/NanoVNASaver/Windows/DisplaySettings.py @@ -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) diff --git a/src/NanoVNASaver/Windows/Files.py b/src/NanoVNASaver/Windows/Files.py index 764ab00..d264192 100644 --- a/src/NanoVNASaver/Windows/Files.py +++ b/src/NanoVNASaver/Windows/Files.py @@ -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