pull/617/head
Holger Müller 2023-03-12 08:02:58 +01:00
rodzic 2c58b2ba8f
commit b768a8e01b
60 zmienionych plików z 296 dodań i 272 usunięć

Wyświetl plik

@ -12,4 +12,4 @@ disable=W0614,C0410,C0321,C0111,I0011,C0103
# allow ls for list # allow ls for list
good-names=_,a,b,c,dt,db,e,f,fn,fd,i,j,k,v,kv,kw,l,m,n,ls,t,t0,t1,t2,t3,w,h,x,y,z,it,op good-names=_,a,b,c,dt,db,e,f,fn,fd,i,j,k,v,kv,kw,l,m,n,ls,t,t0,t1,t2,t3,w,h,x,y,z,it,op
[MASTER] [MASTER]
extension-pkg-whitelist=PyQt5 extension-pkg-whitelist=PyQt6

Wyświetl plik

@ -39,7 +39,7 @@ points, and generally display and analyze the resulting data.
* Copyright 2019, 2020 Rune B. Broberg * Copyright 2019, 2020 Rune B. Broberg
* Copyright 2020ff NanoVNA-Saver Authors * Copyright 2020ff NanoVNA-Saver Authors
It's written in **Python 3** using **PyQt5** and **scipy**. It's written in **Python 3** using **PyQt6** and **scipy**.
Introduction Introduction

Wyświetl plik

@ -1,5 +1,5 @@
pyserial==3.5 pyserial==3.5
PyQt5==5.15.9 PyQt6==5.15.9
numpy==1.24.2 numpy==1.24.2
scipy==1.10.1 scipy==1.10.1
Cython==0.29.33 Cython==0.29.33

Wyświetl plik

@ -31,7 +31,7 @@ python_requires = >=3.8, <4
# For more information, check out https://semver.org/. # For more information, check out https://semver.org/.
install_requires = install_requires =
pyserial>=3.5 pyserial>=3.5
PyQt5>=5.15.0 PyQt6>=5.15.0
numpy>=1.21.1 numpy>=1.21.1
scipy>=1.7.1 scipy>=1.7.1
Cython>=0.29.24 Cython>=0.29.24

Wyświetl plik

@ -21,7 +21,7 @@
import logging import logging
from time import sleep from time import sleep
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
from NanoVNASaver.Analysis.VSWRAnalysis import VSWRAnalysis from NanoVNASaver.Analysis.VSWRAnalysis import VSWRAnalysis

Wyświetl plik

@ -20,7 +20,7 @@ import logging
import math import math
from typing import Dict, List from typing import Dict, List
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
import NanoVNASaver.AnalyticTools as at import NanoVNASaver.AnalyticTools as at
from NanoVNASaver.Analysis.Base import Analysis, CUTOFF_VALS from NanoVNASaver.Analysis.Base import Analysis, CUTOFF_VALS

Wyświetl plik

@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from typing import Dict from typing import Dict
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -28,7 +28,7 @@ CUTOFF_VALS = (3.0, 6.0, 10.0, 20.0, 60.0)
class QHLine(QtWidgets.QFrame): class QHLine(QtWidgets.QFrame):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.setFrameShape(QtWidgets.QFrame.HLine) self.setFrameShape(QtWidgets.QFrame.Shape.HLine)
class Analysis: class Analysis:

Wyświetl plik

@ -19,7 +19,7 @@
import csv import csv
import logging import logging
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
import NanoVNASaver.AnalyticTools as at import NanoVNASaver.AnalyticTools as at
from NanoVNASaver.Analysis.ResonanceAnalysis import ( from NanoVNASaver.Analysis.ResonanceAnalysis import (

Wyświetl plik

@ -20,7 +20,7 @@ import logging
import math import math
from typing import Dict, List from typing import Dict, List
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
import NanoVNASaver.AnalyticTools as at import NanoVNASaver.AnalyticTools as at
from NanoVNASaver.Analysis.Base import Analysis, CUTOFF_VALS from NanoVNASaver.Analysis.Base import Analysis, CUTOFF_VALS

Wyświetl plik

@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
import numpy as np import numpy as np
# pylint: disable=import-error, no-name-in-module # pylint: disable=import-error, no-name-in-module

Wyświetl plik

@ -21,7 +21,7 @@ import csv
import logging import logging
from typing import List from typing import List
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
import NanoVNASaver.AnalyticTools as at import NanoVNASaver.AnalyticTools as at
from NanoVNASaver.Analysis.Base import Analysis, QHLine from NanoVNASaver.Analysis.Base import Analysis, QHLine

Wyświetl plik

@ -19,7 +19,7 @@
import logging import logging
from typing import Callable, List, Tuple from typing import Callable, List, Tuple
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
import numpy as np import numpy as np
from NanoVNASaver.Analysis.Base import Analysis, QHLine from NanoVNASaver.Analysis.Base import Analysis, QHLine

Wyświetl plik

@ -19,7 +19,7 @@
import logging import logging
from typing import List from typing import List
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
import NanoVNASaver.AnalyticTools as at import NanoVNASaver.AnalyticTools as at
from NanoVNASaver.Analysis.Base import Analysis, QHLine from NanoVNASaver.Analysis.Base import Analysis, QHLine

Wyświetl plik

@ -20,7 +20,7 @@ import math
import logging import logging
from typing import List from typing import List
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart

Wyświetl plik

@ -21,9 +21,9 @@ import logging
from dataclasses import dataclass, field, replace from dataclasses import dataclass, field, replace
from typing import List, Set, Tuple, ClassVar, Any, Optional from typing import List, Set, Tuple, ClassVar, Any, Optional
from PyQt5 import QtWidgets, QtGui, QtCore from PyQt6 import QtWidgets, QtGui, QtCore
from PyQt5.QtCore import pyqtSignal from PyQt6.QtCore import pyqtSignal, Qt
from PyQt5.QtGui import QColor from PyQt6.QtGui import QColor, QColorConstants, QAction
from NanoVNASaver import Defaults from NanoVNASaver import Defaults
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
@ -34,20 +34,24 @@ logger = logging.getLogger(__name__)
@dataclass @dataclass
class ChartColors: # pylint: disable=too-many-instance-attributes class ChartColors: # pylint: disable=too-many-instance-attributes
background: QColor = field(default_factory=lambda: QColor(QtCore.Qt.white)) background: QColor = field(
default_factory=lambda: QColor(QColorConstants.White)
)
foreground: QColor = field( foreground: QColor = field(
default_factory=lambda: QColor(QtCore.Qt.lightGray) default_factory=lambda: QColor(QColorConstants.LightGray)
) )
reference: QColor = field(default_factory=lambda: QColor(0, 0, 255, 64)) reference: QColor = field(default_factory=lambda: QColor(0, 0, 255, 64))
reference_secondary: QColor = field( reference_secondary: QColor = field(
default_factory=lambda: QColor(0, 0, 192, 48) default_factory=lambda: QColor(0, 0, 192, 48)
) )
sweep: QColor = field(default_factory=lambda: QColor(QtCore.Qt.darkYellow)) sweep: QColor = field(
default_factory=lambda: QColor(QColorConstants.DarkYellow)
)
sweep_secondary: QColor = field( sweep_secondary: QColor = field(
default_factory=lambda: QColor(QtCore.Qt.darkMagenta) default_factory=lambda: QColor(QColorConstants.DarkMagenta)
) )
swr: QColor = field(default_factory=lambda: QColor(255, 0, 0, 128)) swr: QColor = field(default_factory=lambda: QColor(255, 0, 0, 128))
text: QColor = field(default_factory=lambda: QColor(QtCore.Qt.black)) text: QColor = field(default_factory=lambda: QColor(QColorConstants.Black))
bands: QColor = field(default_factory=lambda: QColor(128, 128, 128, 48)) bands: QColor = field(default_factory=lambda: QColor(128, 128, 128, 48))
@ -130,17 +134,17 @@ class Chart(QtWidgets.QWidget):
self.markers: List[Marker] = [] self.markers: List[Marker] = []
self.swrMarkers: Set[float] = set() self.swrMarkers: Set[float] = set()
self.action_popout = QtWidgets.QAction("Popout chart") self.action_popout = QAction("Popout chart")
self.action_popout.triggered.connect( self.action_popout.triggered.connect(
lambda: self.popoutRequested.emit(self) lambda: self.popoutRequested.emit(self)
) )
self.addAction(self.action_popout) self.addAction(self.action_popout)
self.action_save_screenshot = QtWidgets.QAction("Save image") self.action_save_screenshot = QAction("Save image")
self.action_save_screenshot.triggered.connect(self.saveScreenshot) self.action_save_screenshot.triggered.connect(self.saveScreenshot)
self.addAction(self.action_save_screenshot) self.addAction(self.action_save_screenshot)
self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.setContextMenuPolicy(Qt.ContextMenuPolicy.ActionsContextMenu)
def setReference(self, data): def setReference(self, data):
self.reference = data self.reference = data
@ -209,21 +213,21 @@ class Chart(QtWidgets.QWidget):
self.update() self.update()
def mousePressEvent(self, event: QtGui.QMouseEvent) -> None: def mousePressEvent(self, event: QtGui.QMouseEvent) -> None:
if event.buttons() == QtCore.Qt.RightButton: if event.buttons() == Qt.MouseButton.RightButton:
event.ignore() event.ignore()
return return
if event.buttons() == QtCore.Qt.MiddleButton: if event.buttons() == Qt.MouseButton.MiddleButton:
# Drag event # Drag event
event.accept() event.accept()
self.dragbox.move_x = event.x() self.dragbox.move_x = event.x()
self.dragbox.move_y = event.y() self.dragbox.move_y = event.y()
return return
if event.modifiers() == QtCore.Qt.ControlModifier: if event.modifiers() == Qt.KeyboardModifier.ControlModifier:
event.accept() event.accept()
self.dragbox.state = True self.dragbox.state = True
self.dragbox.pos_start = (event.x(), event.y()) self.dragbox.pos_start = (event.x(), event.y())
return return
if event.modifiers() == QtCore.Qt.ShiftModifier: if event.modifiers() == Qt.KeyboardModifier.ShiftModifier:
self.draggedMarker = self.getNearestMarker(event.x(), event.y()) self.draggedMarker = self.getNearestMarker(event.x(), event.y())
self.mouseMoveEvent(event) self.mouseMoveEvent(event)
@ -233,8 +237,8 @@ class Chart(QtWidgets.QWidget):
self.zoomTo( self.zoomTo(
self.dragbox.pos_start[0], self.dragbox.pos_start[0],
self.dragbox.pos_start[1], self.dragbox.pos_start[1],
a0.x(), a0.position().x(),
a0.y(), a0.position().y(),
) )
self.dragbox.state = False self.dragbox.state = False
self.dragbox.pos = (-1, -1) self.dragbox.pos = (-1, -1)
@ -248,8 +252,8 @@ class Chart(QtWidgets.QWidget):
return return
modifiers = a0.modifiers() modifiers = a0.modifiers()
zoom_x = modifiers != QtCore.Qt.ShiftModifier zoom_x = modifiers != Qt.KeyboardModifier.ShiftModifier
zoom_y = modifiers != QtCore.Qt.ControlModifier zoom_y = modifiers != Qt.KeyboardModifier.ControlModifier
rate = -delta / 120 rate = -delta / 120
# zooming in 10% increments and 9% complementary # zooming in 10% increments and 9% complementary
divisor = 10 if delta > 0 else 9 divisor = 10 if delta > 0 else 9
@ -257,8 +261,8 @@ class Chart(QtWidgets.QWidget):
factor_x = rate * self.dim.width / divisor if zoom_x else 0 factor_x = rate * self.dim.width / divisor if zoom_x else 0
factor_y = rate * self.dim.height / divisor if zoom_y else 0 factor_y = rate * self.dim.height / divisor if zoom_y else 0
abs_x = max(0, a0.x() - self.leftMargin) abs_x = max(0, a0.position().x() - self.leftMargin)
abs_y = max(0, a0.y() - self.topMargin) abs_y = max(0, a0.position().y() - self.topMargin)
ratio_x = abs_x / self.dim.width ratio_x = abs_x / self.dim.width
ratio_y = abs_y / self.dim.height ratio_y = abs_y / self.dim.height
@ -337,6 +341,6 @@ class Chart(QtWidgets.QWidget):
def update(self): def update(self):
pal = self.palette() pal = self.palette()
pal.setColor(QtGui.QPalette.Background, Chart.color.background) pal.setColor(QtGui.QPalette.ColorRole.Window, Chart.color.background)
self.setPalette(pal) self.setPalette(pal)
super().update() super().update()

Wyświetl plik

@ -21,7 +21,8 @@ import logging
from typing import List, Tuple from typing import List, Tuple
import numpy as np import numpy as np
from PyQt5 import QtWidgets, QtGui, QtCore from PyQt6 import QtWidgets, QtGui, QtCore
from PyQt6.QtCore import Qt
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart
from NanoVNASaver.Formatting import ( from NanoVNASaver.Formatting import (
@ -68,22 +69,22 @@ class FrequencyChart(Chart):
self.maxValue = 1 self.maxValue = 1
self.span = 1 self.span = 1
self.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) self.setContextMenuPolicy(Qt.ContextMenuPolicy.DefaultContextMenu)
mode_group = QtWidgets.QActionGroup(self) mode_group = QtGui.QActionGroup(self)
self.menu = QtWidgets.QMenu() self.menu = QtWidgets.QMenu()
self.reset = QtWidgets.QAction("Reset") self.reset = QtGui.QAction("Reset")
self.reset.triggered.connect(self.resetDisplayLimits) self.reset.triggered.connect(self.resetDisplayLimits)
self.menu.addAction(self.reset) self.menu.addAction(self.reset)
self.x_menu = QtWidgets.QMenu("Frequency axis") self.x_menu = QtWidgets.QMenu("Frequency axis")
self.action_automatic = QtWidgets.QAction("Automatic") self.action_automatic = QtGui.QAction("Automatic")
self.action_automatic.setCheckable(True) self.action_automatic.setCheckable(True)
self.action_automatic.setChecked(True) self.action_automatic.setChecked(True)
self.action_automatic.changed.connect( self.action_automatic.changed.connect(
lambda: self.setFixedSpan(self.action_fixed_span.isChecked()) lambda: self.setFixedSpan(self.action_fixed_span.isChecked())
) )
self.action_fixed_span = QtWidgets.QAction("Fixed span") self.action_fixed_span = QtGui.QAction("Fixed span")
self.action_fixed_span.setCheckable(True) self.action_fixed_span.setCheckable(True)
self.action_fixed_span.changed.connect( self.action_fixed_span.changed.connect(
lambda: self.setFixedSpan(self.action_fixed_span.isChecked()) lambda: self.setFixedSpan(self.action_fixed_span.isChecked())
@ -94,12 +95,12 @@ class FrequencyChart(Chart):
self.x_menu.addAction(self.action_fixed_span) self.x_menu.addAction(self.action_fixed_span)
self.x_menu.addSeparator() self.x_menu.addSeparator()
self.action_set_fixed_start = QtWidgets.QAction( self.action_set_fixed_start = QtGui.QAction(
f"Start ({format_frequency_chart(self.minFrequency)})" f"Start ({format_frequency_chart(self.minFrequency)})"
) )
self.action_set_fixed_start.triggered.connect(self.setMinimumFrequency) self.action_set_fixed_start.triggered.connect(self.setMinimumFrequency)
self.action_set_fixed_stop = QtWidgets.QAction( self.action_set_fixed_stop = QtGui.QAction(
f"Stop ({format_frequency_chart(self.maxFrequency)})" f"Stop ({format_frequency_chart(self.maxFrequency)})"
) )
self.action_set_fixed_stop.triggered.connect(self.setMaximumFrequency) self.action_set_fixed_stop.triggered.connect(self.setMaximumFrequency)
@ -108,10 +109,10 @@ class FrequencyChart(Chart):
self.x_menu.addAction(self.action_set_fixed_stop) self.x_menu.addAction(self.action_set_fixed_stop)
self.x_menu.addSeparator() self.x_menu.addSeparator()
frequency_mode_group = QtWidgets.QActionGroup(self.x_menu) frequency_mode_group = QtGui.QActionGroup(self.x_menu)
self.action_set_linear_x = QtWidgets.QAction("Linear") self.action_set_linear_x = QtGui.QAction("Linear")
self.action_set_linear_x.setCheckable(True) self.action_set_linear_x.setCheckable(True)
self.action_set_logarithmic_x = QtWidgets.QAction("Logarithmic") self.action_set_logarithmic_x = QtGui.QAction("Logarithmic")
self.action_set_logarithmic_x.setCheckable(True) self.action_set_logarithmic_x.setCheckable(True)
frequency_mode_group.addAction(self.action_set_linear_x) frequency_mode_group.addAction(self.action_set_linear_x)
frequency_mode_group.addAction(self.action_set_logarithmic_x) frequency_mode_group.addAction(self.action_set_logarithmic_x)
@ -126,30 +127,30 @@ class FrequencyChart(Chart):
self.x_menu.addAction(self.action_set_logarithmic_x) self.x_menu.addAction(self.action_set_logarithmic_x)
self.y_menu = QtWidgets.QMenu("Data axis") self.y_menu = QtWidgets.QMenu("Data axis")
self.y_action_automatic = QtWidgets.QAction("Automatic") self.y_action_automatic = QtGui.QAction("Automatic")
self.y_action_automatic.setCheckable(True) self.y_action_automatic.setCheckable(True)
self.y_action_automatic.setChecked(True) self.y_action_automatic.setChecked(True)
self.y_action_automatic.changed.connect( self.y_action_automatic.changed.connect(
lambda: self.setFixedValues(self.y_action_fixed_span.isChecked()) lambda: self.setFixedValues(self.y_action_fixed_span.isChecked())
) )
self.y_action_fixed_span = QtWidgets.QAction("Fixed span") self.y_action_fixed_span = QtGui.QAction("Fixed span")
self.y_action_fixed_span.setCheckable(True) self.y_action_fixed_span.setCheckable(True)
self.y_action_fixed_span.changed.connect( self.y_action_fixed_span.changed.connect(
lambda: self.setFixedValues(self.y_action_fixed_span.isChecked()) lambda: self.setFixedValues(self.y_action_fixed_span.isChecked())
) )
mode_group = QtWidgets.QActionGroup(self) mode_group = QtGui.QActionGroup(self)
mode_group.addAction(self.y_action_automatic) mode_group.addAction(self.y_action_automatic)
mode_group.addAction(self.y_action_fixed_span) mode_group.addAction(self.y_action_fixed_span)
self.y_menu.addAction(self.y_action_automatic) self.y_menu.addAction(self.y_action_automatic)
self.y_menu.addAction(self.y_action_fixed_span) self.y_menu.addAction(self.y_action_fixed_span)
self.y_menu.addSeparator() self.y_menu.addSeparator()
self.action_set_fixed_minimum = QtWidgets.QAction( self.action_set_fixed_minimum = QtGui.QAction(
f"Minimum ({self.minDisplayValue})" f"Minimum ({self.minDisplayValue})"
) )
self.action_set_fixed_minimum.triggered.connect(self.setMinimumValue) self.action_set_fixed_minimum.triggered.connect(self.setMinimumValue)
self.action_set_fixed_maximum = QtWidgets.QAction( self.action_set_fixed_maximum = QtGui.QAction(
f"Maximum ({self.maxDisplayValue})" f"Maximum ({self.maxDisplayValue})"
) )
self.action_set_fixed_maximum.triggered.connect(self.setMaximumValue) self.action_set_fixed_maximum.triggered.connect(self.setMaximumValue)
@ -159,10 +160,10 @@ class FrequencyChart(Chart):
if self.logarithmicYAllowed(): # This only works for some plot types if self.logarithmicYAllowed(): # This only works for some plot types
self.y_menu.addSeparator() self.y_menu.addSeparator()
vertical_mode_group = QtWidgets.QActionGroup(self.y_menu) vertical_mode_group = QtGui.QActionGroup(self.y_menu)
self.action_set_linear_y = QtWidgets.QAction("Linear") self.action_set_linear_y = QtGui.QAction("Linear")
self.action_set_linear_y.setCheckable(True) self.action_set_linear_y.setCheckable(True)
self.action_set_logarithmic_y = QtWidgets.QAction("Logarithmic") self.action_set_logarithmic_y = QtGui.QAction("Logarithmic")
self.action_set_logarithmic_y.setCheckable(True) self.action_set_logarithmic_y.setCheckable(True)
vertical_mode_group.addAction(self.action_set_linear_y) vertical_mode_group.addAction(self.action_set_linear_y)
vertical_mode_group.addAction(self.action_set_logarithmic_y) vertical_mode_group.addAction(self.action_set_logarithmic_y)
@ -180,12 +181,12 @@ class FrequencyChart(Chart):
self.menu.addMenu(self.y_menu) self.menu.addMenu(self.y_menu)
self.menu.addSeparator() self.menu.addSeparator()
self.menu.addAction(self.action_save_screenshot) self.menu.addAction(self.action_save_screenshot)
self.action_popout = QtWidgets.QAction("Popout chart") self.action_popout = QtGui.QAction("Popout chart")
self.action_popout.triggered.connect( self.action_popout.triggered.connect(
lambda: self.popoutRequested.emit(self) lambda: self.popoutRequested.emit(self)
) )
self.menu.addAction(self.action_popout) self.menu.addAction(self.action_popout)
self.setFocusPolicy(QtCore.Qt.ClickFocus) self.setFocusPolicy(Qt.FocusPolicy.ClickFocus)
self.setMinimumSize( self.setMinimumSize(
self.dim.width + self.rightMargin + self.leftMargin, self.dim.width + self.rightMargin + self.leftMargin,
@ -193,12 +194,12 @@ class FrequencyChart(Chart):
) )
self.setSizePolicy( self.setSizePolicy(
QtWidgets.QSizePolicy( QtWidgets.QSizePolicy(
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
) )
) )
pal = QtGui.QPalette() pal = QtGui.QPalette()
pal.setColor(QtGui.QPalette.Background, Chart.color.background) pal.setColor(QtGui.QPalette.ColorRole.Window, Chart.color.background)
self.setPalette(pal) self.setPalette(pal)
self.setAutoFillBackground(True) self.setAutoFillBackground(True)
@ -437,15 +438,15 @@ class FrequencyChart(Chart):
self.update() self.update()
def mouseMoveEvent(self, a0: QtGui.QMouseEvent): def mouseMoveEvent(self, a0: QtGui.QMouseEvent):
if a0.buttons() == QtCore.Qt.RightButton: if a0.buttons() == Qt.MouseButton.RightButton:
a0.ignore() a0.ignore()
return return
if a0.buttons() == QtCore.Qt.MiddleButton: if a0.buttons() == Qt.MouseButton.MiddleButton:
# Drag the display # Drag the display
a0.accept() a0.accept()
if self.dragbox.move_x != -1 and self.dragbox.move_y != -1: if self.dragbox.move_x != -1 and self.dragbox.move_y != -1:
dx = self.dragbox.move_x - a0.x() dx = self.dragbox.move_x - a0.position().x()
dy = self.dragbox.move_y - a0.y() dy = self.dragbox.move_y - a0.position().y()
self.zoomTo( self.zoomTo(
self.leftMargin + dx, self.leftMargin + dx,
self.topMargin + dy, self.topMargin + dy,
@ -453,18 +454,18 @@ class FrequencyChart(Chart):
self.topMargin + self.dim.height + dy, self.topMargin + self.dim.height + dy,
) )
self.dragbox.move_x = a0.x() self.dragbox.move_x = a0.position().x()
self.dragbox.move_y = a0.y() self.dragbox.move_y = a0.position().y()
return return
if a0.modifiers() == QtCore.Qt.ControlModifier: if a0.modifiers() == Qt.KeyboardModifier.ControlModifier:
# Dragging a box # Dragging a box
if not self.dragbox.state: if not self.dragbox.state:
self.dragbox.pos_start = (a0.x(), a0.y()) self.dragbox.pos_start = (a0.position().x(), a0.position().y())
self.dragbox.pos = (a0.x(), a0.y()) self.dragbox.pos = (a0.position().x(), a0.position().y())
self.update() self.update()
a0.accept() a0.accept()
return return
x = a0.x() x = a0.position().x()
f = self.frequencyAtPosition(x) f = self.frequencyAtPosition(x)
if x == -1: if x == -1:
a0.ignore() a0.ignore()
@ -500,7 +501,7 @@ class FrequencyChart(Chart):
and (not self.reference or self._data_oob(self.reference)) and (not self.reference or self._data_oob(self.reference))
): ):
# Data outside frequency range # Data outside frequency range
qp.setBackgroundMode(QtCore.Qt.OpaqueMode) qp.setBackgroundMode(Qt.OpaqueMode)
qp.setBackground(Chart.color.background) qp.setBackground(Chart.color.background)
qp.setPen(Chart.color.text) qp.setPen(Chart.color.text)
qp.drawText( qp.drawText(
@ -510,7 +511,7 @@ class FrequencyChart(Chart):
) )
def drawDragbog(self, qp: QtGui.QPainter): def drawDragbog(self, qp: QtGui.QPainter):
dashed_pen = QtGui.QPen(Chart.color.foreground, 1, QtCore.Qt.DashLine) dashed_pen = QtGui.QPen(Chart.color.foreground, 1, Qt.DashLine)
qp.setPen(dashed_pen) qp.setPen(dashed_pen)
top_left = QtCore.QPoint( top_left = QtCore.QPoint(
self.dragbox.pos_start[0], self.dragbox.pos_start[1] self.dragbox.pos_start[0], self.dragbox.pos_start[1]
@ -803,16 +804,14 @@ class FrequencyChart(Chart):
def keyPressEvent(self, a0: QtGui.QKeyEvent) -> None: def keyPressEvent(self, a0: QtGui.QKeyEvent) -> None:
m = self.getActiveMarker() m = self.getActiveMarker()
if m is not None and a0.modifiers() == QtCore.Qt.NoModifier: if m is not None and a0.modifiers() == Qt.KeyboardModifier.NoModifier:
if a0.key() in [QtCore.Qt.Key_Down, QtCore.Qt.Key_Left]: if a0.key() in [Qt.Key.Key_Down, Qt.Key.Key_Left]:
m.frequencyInput.keyPressEvent( m.frequencyInput.keyPressEvent(
QtGui.QKeyEvent( QtGui.QKeyEvent(a0.type(), Qt.Key.Key_Down, a0.modifiers())
a0.type(), QtCore.Qt.Key_Down, a0.modifiers()
)
) )
elif a0.key() in [QtCore.Qt.Key_Up, QtCore.Qt.Key_Right]: elif a0.key() in [Qt.Key.Key_Up, Qt.Key.Key_Right]:
m.frequencyInput.keyPressEvent( m.frequencyInput.keyPressEvent(
QtGui.QKeyEvent(a0.type(), QtCore.Qt.Key_Up, a0.modifiers()) QtGui.QKeyEvent(a0.type(), Qt.Key.Key_Up, a0.modifiers())
) )
else: else:
super().keyPressEvent(a0) super().keyPressEvent(a0)

Wyświetl plik

@ -22,7 +22,7 @@ from typing import List
import numpy as np import numpy as np
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint

Wyświetl plik

@ -21,7 +21,7 @@ import math
import logging import logging
from typing import List from typing import List
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart
from NanoVNASaver.Charts.Frequency import FrequencyChart from NanoVNASaver.Charts.Frequency import FrequencyChart

Wyświetl plik

@ -20,7 +20,7 @@ import math
import logging import logging
from typing import List from typing import List
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart

Wyświetl plik

@ -20,7 +20,7 @@ import math
import logging import logging
from typing import List from typing import List
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.SITools import Format, Value, round_ceil, round_floor from NanoVNASaver.SITools import Format, Value, round_ceil, round_floor

Wyświetl plik

@ -20,7 +20,7 @@ import math
import logging import logging
from typing import List from typing import List
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.Marker.Widget import Marker from NanoVNASaver.Marker.Widget import Marker
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint

Wyświetl plik

@ -22,7 +22,7 @@ import logging
from typing import List from typing import List
import numpy as np import numpy as np
from PyQt5 import QtWidgets, QtGui from PyQt6 import QtWidgets, QtGui
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart
@ -47,7 +47,7 @@ class PhaseChart(FrequencyChart):
self.maxDisplayValue = 180 self.maxDisplayValue = 180
self.y_menu.addSeparator() self.y_menu.addSeparator()
self.action_unwrap = QtWidgets.QAction("Unwrap") self.action_unwrap = QtGui.QAction("Unwrap")
self.action_unwrap.setCheckable(True) self.action_unwrap.setCheckable(True)
self.action_unwrap.triggered.connect( self.action_unwrap.triggered.connect(
lambda: self.setUnwrap(self.action_unwrap.isChecked()) lambda: self.setUnwrap(self.action_unwrap.isChecked())

Wyświetl plik

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtGui, QtCore from PyQt6 import QtGui, QtCore
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart
from NanoVNASaver.Charts.Square import SquareChart from NanoVNASaver.Charts.Square import SquareChart

Wyświetl plik

@ -20,7 +20,7 @@ import math
import logging import logging
from typing import List from typing import List
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart

Wyświetl plik

@ -20,7 +20,7 @@ import math
import logging import logging
from typing import List, Optional from typing import List, Optional
from PyQt5 import QtWidgets, QtGui from PyQt6 import QtWidgets, QtGui
from NanoVNASaver.Formatting import format_frequency_chart from NanoVNASaver.Formatting import format_frequency_chart
from NanoVNASaver.Marker.Widget import Marker from NanoVNASaver.Marker.Widget import Marker
@ -58,18 +58,18 @@ class RealImaginaryChart(FrequencyChart):
self.y_menu.clear() self.y_menu.clear()
self.y_action_automatic = QtWidgets.QAction("Automatic") self.y_action_automatic = QtGui.QAction("Automatic")
self.y_action_automatic.setCheckable(True) self.y_action_automatic.setCheckable(True)
self.y_action_automatic.setChecked(True) self.y_action_automatic.setChecked(True)
self.y_action_automatic.changed.connect( self.y_action_automatic.changed.connect(
lambda: self.setFixedValues(self.y_action_fixed_span.isChecked()) lambda: self.setFixedValues(self.y_action_fixed_span.isChecked())
) )
self.y_action_fixed_span = QtWidgets.QAction("Fixed span") self.y_action_fixed_span = QtGui.QAction("Fixed span")
self.y_action_fixed_span.setCheckable(True) self.y_action_fixed_span.setCheckable(True)
self.y_action_fixed_span.changed.connect( self.y_action_fixed_span.changed.connect(
lambda: self.setFixedValues(self.y_action_fixed_span.isChecked()) lambda: self.setFixedValues(self.y_action_fixed_span.isChecked())
) )
mode_group = QtWidgets.QActionGroup(self) mode_group = QtGui.QActionGroup(self)
mode_group.addAction(self.y_action_automatic) mode_group.addAction(self.y_action_automatic)
mode_group.addAction(self.y_action_fixed_span) mode_group.addAction(self.y_action_fixed_span)
self.y_menu.addAction(self.y_action_automatic) self.y_menu.addAction(self.y_action_automatic)

Wyświetl plik

@ -21,7 +21,7 @@ import numpy as np
import logging import logging
from scipy.constants import mu_0 from scipy.constants import mu_0
from PyQt5 import QtWidgets, QtGui from PyQt6 import QtWidgets, QtGui
from NanoVNASaver.Formatting import format_frequency_chart from NanoVNASaver.Formatting import format_frequency_chart
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
@ -38,28 +38,28 @@ class RealImaginaryMuChart(RealImaginaryChart):
super().__init__(name) super().__init__(name)
self.y_menu.addSeparator() self.y_menu.addSeparator()
self.action_set_fixed_maximum_real = QtWidgets.QAction( self.action_set_fixed_maximum_real = QtGui.QAction(
f"Maximum {MU}' ({self.maxDisplayReal})" f"Maximum {MU}' ({self.maxDisplayReal})"
) )
self.action_set_fixed_maximum_real.triggered.connect( self.action_set_fixed_maximum_real.triggered.connect(
self.setMaximumRealValue self.setMaximumRealValue
) )
self.action_set_fixed_minimum_real = QtWidgets.QAction( self.action_set_fixed_minimum_real = QtGui.QAction(
f"Minimum {MU}' ({self.minDisplayReal})" f"Minimum {MU}' ({self.minDisplayReal})"
) )
self.action_set_fixed_minimum_real.triggered.connect( self.action_set_fixed_minimum_real.triggered.connect(
self.setMinimumRealValue self.setMinimumRealValue
) )
self.action_set_fixed_maximum_imag = QtWidgets.QAction( self.action_set_fixed_maximum_imag = QtGui.QAction(
f"Maximum {MU}'' ({self.maxDisplayImag})" f"Maximum {MU}'' ({self.maxDisplayImag})"
) )
self.action_set_fixed_maximum_imag.triggered.connect( self.action_set_fixed_maximum_imag.triggered.connect(
self.setMaximumImagValue self.setMaximumImagValue
) )
self.action_set_fixed_minimum_imag = QtWidgets.QAction( self.action_set_fixed_minimum_imag = QtGui.QAction(
f"Minimum {MU}'' ({self.minDisplayImag})" f"Minimum {MU}'' ({self.minDisplayImag})"
) )
self.action_set_fixed_minimum_imag.triggered.connect( self.action_set_fixed_minimum_imag.triggered.connect(
@ -79,15 +79,13 @@ class RealImaginaryMuChart(RealImaginaryChart):
self.coreWindings = 1 self.coreWindings = 1
self.menu.addSeparator() self.menu.addSeparator()
self.action_set_core_length = QtWidgets.QAction("Core effective length") self.action_set_core_length = QtGui.QAction("Core effective length")
self.action_set_core_length.triggered.connect(self.setCoreLength) self.action_set_core_length.triggered.connect(self.setCoreLength)
self.action_set_core_area = QtWidgets.QAction("Core area") self.action_set_core_area = QtGui.QAction("Core area")
self.action_set_core_area.triggered.connect(self.setCoreArea) self.action_set_core_area.triggered.connect(self.setCoreArea)
self.action_set_core_windings = QtWidgets.QAction( self.action_set_core_windings = QtGui.QAction("Core number of windings")
"Core number of windings"
)
self.action_set_core_windings.triggered.connect(self.setCoreWindings) self.action_set_core_windings.triggered.connect(self.setCoreWindings)
self.menu.addAction(self.action_set_core_length) self.menu.addAction(self.action_set_core_length)

Wyświetl plik

@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtGui from PyQt6 import QtWidgets, QtGui
from NanoVNASaver.Formatting import format_frequency_chart from NanoVNASaver.Formatting import format_frequency_chart
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
@ -34,28 +34,28 @@ class RealImaginaryZChart(RealImaginaryChart):
super().__init__(name) super().__init__(name)
self.y_menu.addSeparator() self.y_menu.addSeparator()
self.action_set_fixed_maximum_real = QtWidgets.QAction( self.action_set_fixed_maximum_real = QtGui.QAction(
f"Maximum R ({self.maxDisplayReal})" f"Maximum R ({self.maxDisplayReal})"
) )
self.action_set_fixed_maximum_real.triggered.connect( self.action_set_fixed_maximum_real.triggered.connect(
self.setMaximumRealValue self.setMaximumRealValue
) )
self.action_set_fixed_minimum_real = QtWidgets.QAction( self.action_set_fixed_minimum_real = QtGui.QAction(
f"Minimum R ({self.minDisplayReal})" f"Minimum R ({self.minDisplayReal})"
) )
self.action_set_fixed_minimum_real.triggered.connect( self.action_set_fixed_minimum_real.triggered.connect(
self.setMinimumRealValue self.setMinimumRealValue
) )
self.action_set_fixed_maximum_imag = QtWidgets.QAction( self.action_set_fixed_maximum_imag = QtGui.QAction(
f"Maximum jX ({self.maxDisplayImag})" f"Maximum jX ({self.maxDisplayImag})"
) )
self.action_set_fixed_maximum_imag.triggered.connect( self.action_set_fixed_maximum_imag.triggered.connect(
self.setMaximumImagValue self.setMaximumImagValue
) )
self.action_set_fixed_minimum_imag = QtWidgets.QAction( self.action_set_fixed_minimum_imag = QtGui.QAction(
f"Minimum jX ({self.minDisplayImag})" f"Minimum jX ({self.minDisplayImag})"
) )
self.action_set_fixed_minimum_imag.triggered.connect( self.action_set_fixed_minimum_imag.triggered.connect(

Wyświetl plik

@ -19,7 +19,7 @@
import logging import logging
from typing import List from typing import List
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart

Wyświetl plik

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtGui, QtCore from PyQt6 import QtGui, QtCore
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart
from NanoVNASaver.Charts.Square import SquareChart from NanoVNASaver.Charts.Square import SquareChart

Wyświetl plik

@ -20,7 +20,7 @@ import logging
import math import math
from typing import List from typing import List
from PyQt5 import QtGui, QtCore, QtWidgets from PyQt6 import QtGui, QtCore, QtWidgets
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
@ -32,7 +32,8 @@ class SquareChart(Chart):
def __init__(self, name=""): def __init__(self, name=""):
super().__init__(name) super().__init__(name)
sizepolicy = QtWidgets.QSizePolicy( sizepolicy = QtWidgets.QSizePolicy(
QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.MinimumExpanding QtWidgets.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
) )
self.setSizePolicy(sizepolicy) self.setSizePolicy(sizepolicy)
self.dim.width = 250 self.dim.width = 250
@ -40,7 +41,7 @@ class SquareChart(Chart):
self.setMinimumSize(self.dim.width + 40, self.dim.height + 40) self.setMinimumSize(self.dim.width + 40, self.dim.height + 40)
pal = QtGui.QPalette() pal = QtGui.QPalette()
pal.setColor(QtGui.QPalette.Background, Chart.color.background) pal.setColor(QtGui.QPalette.ColorRole.Window, Chart.color.background)
self.setPalette(pal) self.setPalette(pal)
self.setAutoFillBackground(True) self.setAutoFillBackground(True)
@ -112,12 +113,12 @@ class SquareChart(Chart):
self.update() self.update()
def mouseMoveEvent(self, a0: QtGui.QMouseEvent): def mouseMoveEvent(self, a0: QtGui.QMouseEvent):
if a0.buttons() == QtCore.Qt.RightButton: if a0.buttons() == QtCore.Qt.MouseButton.RightButton:
a0.ignore() a0.ignore()
return return
x = a0.x() x = a0.position().x()
y = a0.y() y = a0.position().y()
absx = x - (self.width() - self.dim.width) / 2 absx = x - (self.width() - self.dim.width) / 2
absy = y - (self.height() - self.dim.height) / 2 absy = y - (self.height() - self.dim.height) / 2
if ( if (

Wyświetl plik

@ -20,7 +20,8 @@ import math
import logging import logging
import numpy as np import numpy as np
from PyQt5 import QtWidgets, QtGui, QtCore from PyQt6 import QtWidgets, QtGui, QtCore
from PyQt6.QtCore import Qt
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart
@ -48,31 +49,31 @@ class TDRChart(Chart):
self.setMinimumSize(300, 300) self.setMinimumSize(300, 300)
self.setSizePolicy( self.setSizePolicy(
QtWidgets.QSizePolicy( QtWidgets.QSizePolicy(
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
) )
) )
pal = QtGui.QPalette() pal = QtGui.QPalette()
pal.setColor(QtGui.QPalette.Background, Chart.color.background) pal.setColor(QtGui.QPalette.ColorRole.Window, Chart.color.background)
self.setPalette(pal) self.setPalette(pal)
self.setAutoFillBackground(True) self.setAutoFillBackground(True)
self.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu) self.setContextMenuPolicy(Qt.ContextMenuPolicy.DefaultContextMenu)
self.menu = QtWidgets.QMenu() self.menu = QtWidgets.QMenu()
self.reset = QtWidgets.QAction("Reset") self.reset = QtGui.QAction("Reset")
self.reset.triggered.connect(self.resetDisplayLimits) self.reset.triggered.connect(self.resetDisplayLimits)
self.menu.addAction(self.reset) self.menu.addAction(self.reset)
self.x_menu = QtWidgets.QMenu("Length axis") self.x_menu = QtWidgets.QMenu("Length axis")
self.mode_group = QtWidgets.QActionGroup(self.x_menu) self.mode_group = QtGui.QActionGroup(self.x_menu)
self.action_automatic = QtWidgets.QAction("Automatic") self.action_automatic = QtGui.QAction("Automatic")
self.action_automatic.setCheckable(True) self.action_automatic.setCheckable(True)
self.action_automatic.setChecked(True) self.action_automatic.setChecked(True)
self.action_automatic.changed.connect( self.action_automatic.changed.connect(
lambda: self.setFixedSpan(self.action_fixed_span.isChecked()) lambda: self.setFixedSpan(self.action_fixed_span.isChecked())
) )
self.action_fixed_span = QtWidgets.QAction("Fixed span") self.action_fixed_span = QtGui.QAction("Fixed span")
self.action_fixed_span.setCheckable(True) self.action_fixed_span.setCheckable(True)
self.action_fixed_span.changed.connect( self.action_fixed_span.changed.connect(
lambda: self.setFixedSpan(self.action_fixed_span.isChecked()) lambda: self.setFixedSpan(self.action_fixed_span.isChecked())
@ -83,12 +84,12 @@ class TDRChart(Chart):
self.x_menu.addAction(self.action_fixed_span) self.x_menu.addAction(self.action_fixed_span)
self.x_menu.addSeparator() self.x_menu.addSeparator()
self.action_set_fixed_start = QtWidgets.QAction( self.action_set_fixed_start = QtGui.QAction(
f"Start ({self.minDisplayLength})" f"Start ({self.minDisplayLength})"
) )
self.action_set_fixed_start.triggered.connect(self.setMinimumLength) self.action_set_fixed_start.triggered.connect(self.setMinimumLength)
self.action_set_fixed_stop = QtWidgets.QAction( self.action_set_fixed_stop = QtGui.QAction(
f"Stop ({self.maxDisplayLength})" f"Stop ({self.maxDisplayLength})"
) )
self.action_set_fixed_stop.triggered.connect(self.setMaximumLength) self.action_set_fixed_stop.triggered.connect(self.setMaximumLength)
@ -97,14 +98,14 @@ class TDRChart(Chart):
self.x_menu.addAction(self.action_set_fixed_stop) self.x_menu.addAction(self.action_set_fixed_stop)
self.y_menu = QtWidgets.QMenu("Impedance axis") self.y_menu = QtWidgets.QMenu("Impedance axis")
self.y_mode_group = QtWidgets.QActionGroup(self.y_menu) self.y_mode_group = QtGui.QActionGroup(self.y_menu)
self.y_action_automatic = QtWidgets.QAction("Automatic") self.y_action_automatic = QtGui.QAction("Automatic")
self.y_action_automatic.setCheckable(True) self.y_action_automatic.setCheckable(True)
self.y_action_automatic.setChecked(True) self.y_action_automatic.setChecked(True)
self.y_action_automatic.changed.connect( self.y_action_automatic.changed.connect(
lambda: self.setFixedValues(self.y_action_fixed.isChecked()) lambda: self.setFixedValues(self.y_action_fixed.isChecked())
) )
self.y_action_fixed = QtWidgets.QAction("Fixed") self.y_action_fixed = QtGui.QAction("Fixed")
self.y_action_fixed.setCheckable(True) self.y_action_fixed.setCheckable(True)
self.y_action_fixed.changed.connect( self.y_action_fixed.changed.connect(
lambda: self.setFixedValues(self.y_action_fixed.isChecked()) lambda: self.setFixedValues(self.y_action_fixed.isChecked())
@ -115,14 +116,14 @@ class TDRChart(Chart):
self.y_menu.addAction(self.y_action_fixed) self.y_menu.addAction(self.y_action_fixed)
self.y_menu.addSeparator() self.y_menu.addSeparator()
self.y_action_set_fixed_maximum = QtWidgets.QAction( self.y_action_set_fixed_maximum = QtGui.QAction(
f"Maximum ({self.maxImpedance})" f"Maximum ({self.maxImpedance})"
) )
self.y_action_set_fixed_maximum.triggered.connect( self.y_action_set_fixed_maximum.triggered.connect(
self.setMaximumImpedance self.setMaximumImpedance
) )
self.y_action_set_fixed_minimum = QtWidgets.QAction( self.y_action_set_fixed_minimum = QtGui.QAction(
f"Minimum ({self.minImpedance})" f"Minimum ({self.minImpedance})"
) )
self.y_action_set_fixed_minimum.triggered.connect( self.y_action_set_fixed_minimum.triggered.connect(
@ -136,7 +137,7 @@ class TDRChart(Chart):
self.menu.addMenu(self.y_menu) self.menu.addMenu(self.y_menu)
self.menu.addSeparator() self.menu.addSeparator()
self.menu.addAction(self.action_save_screenshot) self.menu.addAction(self.action_save_screenshot)
self.action_popout = QtWidgets.QAction("Popout chart") self.action_popout = QtGui.QAction("Popout chart")
self.action_popout.triggered.connect( self.action_popout.triggered.connect(
lambda: self.popoutRequested.emit(self) lambda: self.popoutRequested.emit(self)
) )
@ -256,34 +257,34 @@ class TDRChart(Chart):
return new_chart return new_chart
def mouseMoveEvent(self, a0: QtGui.QMouseEvent) -> None: def mouseMoveEvent(self, a0: QtGui.QMouseEvent) -> None:
if a0.buttons() == QtCore.Qt.RightButton: if a0.buttons() == Qt.MouseButton.RightButton:
a0.ignore() a0.ignore()
return return
if a0.buttons() == QtCore.Qt.MiddleButton: if a0.buttons() == Qt.MouseButton.MiddleButton:
# Drag the display # Drag the display
a0.accept() a0.accept()
if self.dragbox.move_x != -1 and self.dragbox.move_y != -1: if self.dragbox.move_x != -1 and self.dragbox.move_y != -1:
dx = self.dragbox.move_x - a0.x() dx = self.dragbox.move_x - a0.position().x()
dy = self.dragbox.move_y - a0.y() dy = self.dragbox.move_y - a0.position().y()
self.zoomTo( self.zoomTo(
self.leftMargin + dx, self.leftMargin + dx,
self.topMargin + dy, self.topMargin + dy,
self.leftMargin + self.dim.width + dx, self.leftMargin + self.dim.width + dx,
self.topMargin + self.dim.height + dy, self.topMargin + self.dim.height + dy,
) )
self.dragbox.move_x = a0.x() self.dragbox.move_x = a0.position().x()
self.dragbox.move_y = a0.y() self.dragbox.move_y = a0.position().y()
return return
if a0.modifiers() == QtCore.Qt.ControlModifier: if a0.modifiers() == Qt.KeyboardModifier.ControlModifier:
# Dragging a box # Dragging a box
if not self.dragbox.state: if not self.dragbox.state:
self.dragbox.pos_start = (a0.x(), a0.y()) self.dragbox.pos_start = (a0.position().x(), a0.position().y())
self.dragbox.pos = (a0.x(), a0.y()) self.dragbox.pos = (a0.position().x(), a0.position().y())
self.update() self.update()
a0.accept() a0.accept()
return return
x = a0.x() x = a0.position().x()
absx = x - self.leftMargin absx = x - self.leftMargin
if absx < 0 or absx > self.width() - self.rightMargin: if absx < 0 or absx > self.width() - self.rightMargin:
a0.ignore() a0.ignore()

Wyświetl plik

@ -20,7 +20,7 @@ import math
import logging import logging
from typing import List from typing import List
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.Charts.Chart import Chart from NanoVNASaver.Charts.Chart import Chart

Wyświetl plik

@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

Wyświetl plik

@ -18,8 +18,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore
from PyQt5.QtWidgets import QCheckBox from PyQt6.QtWidgets import QCheckBox, QSizePolicy
from NanoVNASaver import Defaults from NanoVNASaver import Defaults
from NanoVNASaver.Marker.Widget import Marker from NanoVNASaver.Marker.Widget import Marker
@ -70,9 +70,11 @@ class MarkerControl(Control):
self.showMarkerButton.clicked.connect(self.toggle_frame) self.showMarkerButton.clicked.connect(self.toggle_frame)
lock_radiobutton = QtWidgets.QRadioButton("Locked") lock_radiobutton = QtWidgets.QRadioButton("Locked")
lock_radiobutton.setLayoutDirection(QtCore.Qt.RightToLeft) lock_radiobutton.setLayoutDirection(
QtCore.Qt.LayoutDirection.RightToLeft
)
lock_radiobutton.setSizePolicy( lock_radiobutton.setSizePolicy(
QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred QSizePolicy.Policy.Maximum, QSizePolicy.Policy.Preferred
) )
hbox = QtWidgets.QHBoxLayout() hbox = QtWidgets.QHBoxLayout()

Wyświetl plik

@ -19,7 +19,7 @@
import logging import logging
from time import sleep from time import sleep
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
from NanoVNASaver.Hardware.Hardware import Interface, get_interfaces, get_VNA from NanoVNASaver.Hardware.Hardware import Interface, get_interfaces, get_VNA
from NanoVNASaver.Controls.Control import Control from NanoVNASaver.Controls.Control import Control

Wyświetl plik

@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore
from NanoVNASaver.Formatting import ( from NanoVNASaver.Formatting import (
format_frequency_sweep, format_frequency_sweep,
@ -36,7 +36,7 @@ class SweepControl(Control):
super().__init__(app, "Sweep control") super().__init__(app, "Sweep control")
line = QtWidgets.QFrame() line = QtWidgets.QFrame()
line.setFrameShape(QtWidgets.QFrame.VLine) line.setFrameShape(QtWidgets.QFrame.Shape.VLine)
input_layout = QtWidgets.QHBoxLayout() input_layout = QtWidgets.QHBoxLayout()
input_left_layout = QtWidgets.QFormLayout() input_left_layout = QtWidgets.QFormLayout()
@ -49,14 +49,14 @@ class SweepControl(Control):
self.input_start = FrequencyInputWidget() self.input_start = FrequencyInputWidget()
self.input_start.setFixedHeight(20) self.input_start.setFixedHeight(20)
self.input_start.setMinimumWidth(60) self.input_start.setMinimumWidth(60)
self.input_start.setAlignment(QtCore.Qt.AlignRight) self.input_start.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.input_start.textEdited.connect(self.update_center_span) self.input_start.textEdited.connect(self.update_center_span)
self.input_start.textChanged.connect(self.update_step_size) self.input_start.textChanged.connect(self.update_step_size)
input_left_layout.addRow(QtWidgets.QLabel("Start"), self.input_start) input_left_layout.addRow(QtWidgets.QLabel("Start"), self.input_start)
self.input_end = FrequencyInputWidget() self.input_end = FrequencyInputWidget()
self.input_end.setFixedHeight(20) self.input_end.setFixedHeight(20)
self.input_end.setAlignment(QtCore.Qt.AlignRight) self.input_end.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.input_end.textEdited.connect(self.update_center_span) self.input_end.textEdited.connect(self.update_center_span)
self.input_end.textChanged.connect(self.update_step_size) self.input_end.textChanged.connect(self.update_step_size)
input_left_layout.addRow(QtWidgets.QLabel("Stop"), self.input_end) input_left_layout.addRow(QtWidgets.QLabel("Stop"), self.input_end)
@ -64,14 +64,14 @@ class SweepControl(Control):
self.input_center = FrequencyInputWidget() self.input_center = FrequencyInputWidget()
self.input_center.setFixedHeight(20) self.input_center.setFixedHeight(20)
self.input_center.setMinimumWidth(60) self.input_center.setMinimumWidth(60)
self.input_center.setAlignment(QtCore.Qt.AlignRight) self.input_center.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.input_center.textEdited.connect(self.update_start_end) self.input_center.textEdited.connect(self.update_start_end)
input_right_layout.addRow(QtWidgets.QLabel("Center"), self.input_center) input_right_layout.addRow(QtWidgets.QLabel("Center"), self.input_center)
self.input_span = FrequencyInputWidget() self.input_span = FrequencyInputWidget()
self.input_span.setFixedHeight(20) self.input_span.setFixedHeight(20)
self.input_span.setAlignment(QtCore.Qt.AlignRight) self.input_span.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.input_span.textEdited.connect(self.update_start_end) self.input_span.textEdited.connect(self.update_start_end)
input_right_layout.addRow(QtWidgets.QLabel("Span"), self.input_span) input_right_layout.addRow(QtWidgets.QLabel("Span"), self.input_span)
@ -79,14 +79,15 @@ class SweepControl(Control):
self.input_segments = QtWidgets.QLineEdit( self.input_segments = QtWidgets.QLineEdit(
self.app.settings.value("Segments", "1") self.app.settings.value("Segments", "1")
) )
self.input_segments.setAlignment(QtCore.Qt.AlignRight) self.input_segments.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.input_segments.setFixedHeight(20) self.input_segments.setFixedHeight(20)
self.input_segments.setFixedWidth(60) self.input_segments.setFixedWidth(60)
self.input_segments.textEdited.connect(self.update_step_size) self.input_segments.textEdited.connect(self.update_step_size)
self.label_step = QtWidgets.QLabel("Hz/step") self.label_step = QtWidgets.QLabel("Hz/step")
self.label_step.setAlignment( self.label_step.setAlignment(
QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter QtCore.Qt.AlignmentFlag.AlignRight
| QtCore.Qt.AlignmentFlag.AlignVCenter
) )
segment_layout = QtWidgets.QHBoxLayout() segment_layout = QtWidgets.QHBoxLayout()
@ -110,11 +111,13 @@ class SweepControl(Control):
self.btn_start = QtWidgets.QPushButton("Sweep") self.btn_start = QtWidgets.QPushButton("Sweep")
self.btn_start.setFixedHeight(20) self.btn_start.setFixedHeight(20)
self.btn_start.clicked.connect(self.app.sweep_start) self.btn_start.clicked.connect(self.app.sweep_start)
self.btn_start.setShortcut(QtCore.Qt.Key_W | QtCore.Qt.CTRL) self.btn_start.setShortcut(
QtCore.Qt.Key.Key_Control + QtCore.Qt.Key.Key_W
)
self.btn_stop = QtWidgets.QPushButton("Stop") self.btn_stop = QtWidgets.QPushButton("Stop")
self.btn_stop.setFixedHeight(20) self.btn_stop.setFixedHeight(20)
self.btn_stop.clicked.connect(self.app.sweep_stop) self.btn_stop.clicked.connect(self.app.sweep_stop)
self.btn_stop.setShortcut(QtCore.Qt.Key_Escape) self.btn_stop.setShortcut(QtCore.Qt.Key.Key_Escape)
self.btn_stop.setDisabled(True) self.btn_stop.setDisabled(True)
btn_layout = QtWidgets.QHBoxLayout() btn_layout = QtWidgets.QHBoxLayout()
btn_layout.addWidget(self.btn_start) btn_layout.addWidget(self.btn_start)

Wyświetl plik

@ -21,9 +21,9 @@ import dataclasses as DC
import logging import logging
from ast import literal_eval from ast import literal_eval
from PyQt5 import QtCore from PyQt6 import QtCore
from PyQt5.QtCore import QSettings, QByteArray from PyQt6.QtCore import QSettings, QByteArray
from PyQt5.QtGui import QColor from PyQt6.QtGui import QColor, QColorConstants
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -69,23 +69,25 @@ class Chart:
@DC.dataclass @DC.dataclass
class ChartColors: # pylint: disable=too-many-instance-attributes class ChartColors: # pylint: disable=too-many-instance-attributes
background: QColor = DC.field( background: QColor = DC.field(
default_factory=lambda: QColor(QtCore.Qt.white) default_factory=lambda: QColor(QColorConstants.White)
) )
foreground: QColor = DC.field( foreground: QColor = DC.field(
default_factory=lambda: QColor(QtCore.Qt.lightGray) default_factory=lambda: QColor(QColorConstants.LightGray)
) )
reference: QColor = DC.field(default_factory=lambda: QColor(0, 0, 255, 64)) reference: QColor = DC.field(default_factory=lambda: QColor(0, 0, 255, 64))
reference_secondary: QColor = DC.field( reference_secondary: QColor = DC.field(
default_factory=lambda: QColor(0, 0, 192, 48) default_factory=lambda: QColor(0, 0, 192, 48)
) )
sweep: QColor = DC.field( sweep: QColor = DC.field(
default_factory=lambda: QColor(QtCore.Qt.darkYellow) default_factory=lambda: QColor(QColorConstants.DarkYellow)
) )
sweep_secondary: QColor = DC.field( sweep_secondary: QColor = DC.field(
default_factory=lambda: QColor(QtCore.Qt.darkMagenta) default_factory=lambda: QColor(QColorConstants.DarkMagenta)
) )
swr: QColor = DC.field(default_factory=lambda: QColor(255, 0, 0, 128)) swr: QColor = DC.field(default_factory=lambda: QColor(255, 0, 0, 128))
text: QColor = DC.field(default_factory=lambda: QColor(QtCore.Qt.black)) text: QColor = DC.field(
default_factory=lambda: QColor(QColorConstants.Black)
)
bands: QColor = DC.field(default_factory=lambda: QColor(128, 128, 128, 48)) bands: QColor = DC.field(default_factory=lambda: QColor(128, 128, 128, 48))
@ -110,7 +112,7 @@ class Markers:
) )
colored_names: bool = True colored_names: bool = True
color_0: QColor = DC.field( color_0: QColor = DC.field(
default_factory=lambda: QColor(QtCore.Qt.darkGray) default_factory=lambda: QColor(QColorConstants.DarkGray)
) )
color_1: QColor = DC.field(default_factory=lambda: QColor(255, 0, 0)) color_1: QColor = DC.field(default_factory=lambda: QColor(255, 0, 0))
color_2: QColor = DC.field(default_factory=lambda: QColor(0, 255, 0)) color_2: QColor = DC.field(default_factory=lambda: QColor(0, 255, 0))
@ -119,7 +121,7 @@ class Markers:
color_5: QColor = DC.field(default_factory=lambda: QColor(255, 0, 255)) color_5: QColor = DC.field(default_factory=lambda: QColor(255, 0, 255))
color_6: QColor = DC.field(default_factory=lambda: QColor(255, 255, 0)) color_6: QColor = DC.field(default_factory=lambda: QColor(255, 255, 0))
color_7: QColor = DC.field( color_7: QColor = DC.field(
default_factory=lambda: QColor(QtCore.Qt.lightGray) default_factory=lambda: QColor(QColorConstants.LightGray)
) )

Wyświetl plik

@ -22,7 +22,7 @@ from typing import List
import serial import serial
import numpy as np import numpy as np
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.Hardware.Serial import drain_serial, Interface from NanoVNASaver.Hardware.Serial import drain_serial, Interface
from NanoVNASaver.Hardware.VNA import VNA from NanoVNASaver.Hardware.VNA import VNA

Wyświetl plik

@ -19,7 +19,7 @@
import logging import logging
import serial import serial
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.Hardware.NanoVNA import NanoVNA from NanoVNASaver.Hardware.NanoVNA import NanoVNA
from NanoVNASaver.Hardware.Serial import Interface from NanoVNASaver.Hardware.Serial import Interface

Wyświetl plik

@ -22,7 +22,7 @@ from typing import List
import serial import serial
import numpy as np import numpy as np
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.Hardware.Serial import drain_serial, Interface from NanoVNASaver.Hardware.Serial import drain_serial, Interface
from NanoVNASaver.Hardware.VNA import VNA from NanoVNASaver.Hardware.VNA import VNA

Wyświetl plik

@ -20,7 +20,7 @@ import logging
from time import sleep from time import sleep
from typing import List, Iterator, Set from typing import List, Iterator, Set
from PyQt5 import QtGui from PyQt6 import QtGui
from NanoVNASaver.Version import Version from NanoVNASaver.Version import Version
from NanoVNASaver.Hardware.Serial import Interface, drain_serial from NanoVNASaver.Hardware.Serial import Interface, drain_serial

Wyświetl plik

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
from PyQt5 import QtGui, QtWidgets, QtCore from PyQt6 import QtGui, QtWidgets, QtCore
from NanoVNASaver.Formatting import format_frequency_inputs from NanoVNASaver.Formatting import format_frequency_inputs

Wyświetl plik

@ -16,7 +16,7 @@
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
from PyQt5 import QtCore from PyQt6 import QtCore
from NanoVNASaver import RFTools from NanoVNASaver import RFTools
from NanoVNASaver.Formatting import ( from NanoVNASaver.Formatting import (

Wyświetl plik

@ -19,8 +19,9 @@
import math import math
from typing import List from typing import List
from PyQt5 import QtGui, QtWidgets, QtCore from PyQt6 import QtGui, QtWidgets, QtCore
from PyQt5.QtCore import pyqtSignal from PyQt6.QtCore import pyqtSignal
from PyQt6.QtGui import QColorConstants
from NanoVNASaver import RFTools from NanoVNASaver import RFTools
from NanoVNASaver.Formatting import ( from NanoVNASaver.Formatting import (
@ -43,7 +44,7 @@ from NanoVNASaver.Inputs import MarkerFrequencyInputWidget as FrequencyInput
from NanoVNASaver.Marker.Values import TYPES, Value, default_label_ids from NanoVNASaver.Marker.Values import TYPES, Value, default_label_ids
COLORS = ( COLORS = (
QtGui.QColor(QtCore.Qt.darkGray), QtGui.QColor(QColorConstants.DarkGray),
QtGui.QColor(255, 0, 0), QtGui.QColor(255, 0, 0),
QtGui.QColor(0, 255, 0), QtGui.QColor(0, 255, 0),
QtGui.QColor(0, 0, 255), QtGui.QColor(0, 0, 255),
@ -90,7 +91,7 @@ class Marker(QtCore.QObject, Value):
self.frequencyInput = FrequencyInput() self.frequencyInput = FrequencyInput()
self.frequencyInput.setMinimumHeight(20) self.frequencyInput.setMinimumHeight(20)
self.frequencyInput.setAlignment(QtCore.Qt.AlignRight) self.frequencyInput.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.frequencyInput.editingFinished.connect( self.frequencyInput.editingFinished.connect(
lambda: self.setFrequency( lambda: self.setFrequency(
parse_frequency(self.frequencyInput.text()) parse_frequency(self.frequencyInput.text())
@ -117,7 +118,8 @@ class Marker(QtCore.QObject, Value):
self.btnColorPicker.clicked.connect( self.btnColorPicker.clicked.connect(
lambda: self.setColor( lambda: self.setColor(
QtWidgets.QColorDialog.getColor( QtWidgets.QColorDialog.getColor(
self.color, options=QtWidgets.QColorDialog.ShowAlphaChannel self.color,
options=QtWidgets.QColorDialog.ColorDialogOption.ShowAlphaChannel,
) )
) )
) )
@ -148,7 +150,7 @@ class Marker(QtCore.QObject, Value):
self.setColor(COLORS[0]) self.setColor(COLORS[0])
line = QtWidgets.QFrame() line = QtWidgets.QFrame()
line.setFrameShape(QtWidgets.QFrame.VLine) line.setFrameShape(QtWidgets.QFrame.Shape.VLine)
# line only if more then 3 selected # line only if more then 3 selected
self.left_form = QtWidgets.QFormLayout() self.left_form = QtWidgets.QFormLayout()
@ -183,7 +185,7 @@ class Marker(QtCore.QObject, Value):
self.label["returnloss"].setMinimumWidth(int(80 * scale)) self.label["returnloss"].setMinimumWidth(int(80 * scale))
if self.coloredText: if self.coloredText:
color_string = QtCore.QVariant(self.color) color_string = QtCore.QVariant(self.color)
color_string.convert(QtCore.QVariant.String) # color_string.convert(QtCore.QVariant.String)
self.group_box.setStyleSheet( self.group_box.setStyleSheet(
f"QGroupBox {{ color: {color_string.value()}; " f"QGroupBox {{ color: {color_string.value()}; "
f"font-size: {self._size_str()}}};" f"font-size: {self._size_str()}}};"
@ -230,11 +232,11 @@ class Marker(QtCore.QObject, Value):
if color.isValid(): if color.isValid():
self.color = color self.color = color
p = self.btnColorPicker.palette() p = self.btnColorPicker.palette()
p.setColor(QtGui.QPalette.ButtonText, self.color) # TODO: p.setColor(QtGui.QPalette.ButtonText, self.color)
self.btnColorPicker.setPalette(p) self.btnColorPicker.setPalette(p)
if self.coloredText: if self.coloredText:
color_string = QtCore.QVariant(color) color_string = QtCore.QVariant(color)
color_string.convert(QtCore.QVariant.String) # TODO: color_string.convert(str)
self.group_box.setStyleSheet( self.group_box.setStyleSheet(
f"QGroupBox {{ color: {color_string.value()}; " f"QGroupBox {{ color: {color_string.value()}; "
f"font-size: {self._size_str()}}};" f"font-size: {self._size_str()}}};"

Wyświetl plik

@ -22,7 +22,7 @@ import sys
import threading import threading
from time import strftime, localtime from time import strftime, localtime
from PyQt5 import QtWidgets, QtCore, QtGui from PyQt6 import QtWidgets, QtCore, QtGui
from NanoVNASaver import Defaults from NanoVNASaver import Defaults
from .Windows import ( from .Windows import (
@ -95,8 +95,8 @@ class NanoVNASaver(QtWidgets.QWidget):
self.icon = QtGui.QIcon("icon_48x48.png") self.icon = QtGui.QIcon("icon_48x48.png")
self.setWindowIcon(self.icon) self.setWindowIcon(self.icon)
self.settings = Defaults.AppSettings( self.settings = Defaults.AppSettings(
QtCore.QSettings.IniFormat, QtCore.QSettings.Format.IniFormat,
QtCore.QSettings.UserScope, QtCore.QSettings.Scope.UserScope,
"NanoVNASaver", "NanoVNASaver",
"NanoVNASaver", "NanoVNASaver",
) )
@ -140,7 +140,9 @@ class NanoVNASaver(QtWidgets.QWidget):
self.baseTitle = f"NanoVNA Saver {NanoVNASaver.version}" self.baseTitle = f"NanoVNA Saver {NanoVNASaver.version}"
self.updateTitle() self.updateTitle()
layout = QtWidgets.QBoxLayout(QtWidgets.QBoxLayout.LeftToRight) layout = QtWidgets.QBoxLayout(
QtWidgets.QBoxLayout.Direction.LeftToRight
)
scrollarea = QtWidgets.QScrollArea() scrollarea = QtWidgets.QScrollArea()
outer = QtWidgets.QVBoxLayout() outer = QtWidgets.QVBoxLayout()
@ -151,12 +153,12 @@ class NanoVNASaver(QtWidgets.QWidget):
Defaults.cfg.gui.window_width, Defaults.cfg.gui.window_height Defaults.cfg.gui.window_width, Defaults.cfg.gui.window_height
) )
scrollarea.setSizePolicy( scrollarea.setSizePolicy(
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
) )
self.setSizePolicy( self.setSizePolicy(
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
) )
widget = QtWidgets.QWidget() widget = QtWidgets.QWidget()
widget.setLayout(layout) widget.setLayout(layout)
@ -236,7 +238,7 @@ class NanoVNASaver(QtWidgets.QWidget):
self.charts_layout = QtWidgets.QGridLayout() self.charts_layout = QtWidgets.QGridLayout()
QtWidgets.QShortcut(QtGui.QKeySequence("Ctrl+Q"), self, self.close) QtGui.QShortcut(QtGui.QKeySequence("Ctrl+Q"), self, self.close)
############################################################### ###############################################################
# Create main layout # Create main layout
@ -388,8 +390,8 @@ class NanoVNASaver(QtWidgets.QWidget):
QtWidgets.QSpacerItem( QtWidgets.QSpacerItem(
1, 1,
1, 1,
QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed,
QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Policy.Expanding,
) )
) )

Wyświetl plik

@ -20,8 +20,8 @@ import contextlib
import logging import logging
import typing import typing
from PyQt5 import QtCore, QtGui from PyQt6 import QtCore, QtGui
from PyQt5.QtCore import QModelIndex from PyQt6.QtCore import QModelIndex, Qt
_DEFAULT_BANDS = ( _DEFAULT_BANDS = (
"2200 m;135700;137800", "2200 m;135700;137800",
@ -58,12 +58,12 @@ class BandsModel(QtCore.QAbstractTableModel):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.settings = QtCore.QSettings( self.settings = QtCore.QSettings(
QtCore.QSettings.IniFormat, QtCore.QSettings.Format.IniFormat,
QtCore.QSettings.UserScope, QtCore.QSettings.Scope.UserScope,
"NanoVNASaver", "NanoVNASaver",
"Bands", "Bands",
) )
self.settings.setIniCodec("UTF-8") # self.settings.setIniCodec("UTF-8")
self.enabled = self.settings.value("ShowBands", False, bool) self.enabled = self.settings.value("ShowBands", False, bool)
self.bands = [ self.bands = [
@ -91,16 +91,15 @@ class BandsModel(QtCore.QAbstractTableModel):
def data(self, index: QModelIndex, role: int = ...) -> QtCore.QVariant: def data(self, index: QModelIndex, role: int = ...) -> QtCore.QVariant:
if role in [ if role in [
QtCore.Qt.DisplayRole, Qt.ItemDataRole.DisplayRole,
QtCore.Qt.ItemDataRole, Qt.ItemDataRole.EditRole,
QtCore.Qt.EditRole,
]: ]:
return QtCore.QVariant(self.bands[index.row()][index.column()]) return QtCore.QVariant(self.bands[index.row()][index.column()])
if role == QtCore.Qt.TextAlignmentRole: if role == Qt.ItemDataRole.TextAlignmentRole:
if index.column() == 0: if index.column() == 0:
return QtCore.QVariant(QtCore.Qt.AlignCenter) return QtCore.QVariant(Qt.AlignmentFlag.AlignCenter)
return QtCore.QVariant( return QtCore.QVariant(
QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter Qt.AlignmentFlag.AlignRight | Qt.AlignmentFlag.AlignVCenter
) )
return QtCore.QVariant() return QtCore.QVariant()
@ -141,22 +140,22 @@ class BandsModel(QtCore.QAbstractTableModel):
return True return True
def headerData( def headerData(
self, section: int, orientation: QtCore.Qt.Orientation, role: int = ... self, section: int, orientation: Qt.Orientation, role: int = ...
): ):
if ( if (
role == QtCore.Qt.DisplayRole role == Qt.ItemDataRole.DisplayRole
and orientation == QtCore.Qt.Horizontal and orientation == Qt.Orientation.Horizontal
): ):
with contextlib.suppress(IndexError): with contextlib.suppress(IndexError):
return _HEADER_DATA[section] return _HEADER_DATA[section]
return None return None
def flags(self, index: QModelIndex) -> QtCore.Qt.ItemFlags: def flags(self, index: QModelIndex) -> Qt.ItemFlag:
if index.isValid(): if index.isValid():
return QtCore.Qt.ItemFlags( return Qt.ItemFlag(
QtCore.Qt.ItemIsEditable Qt.ItemFlag.ItemIsEditable
| QtCore.Qt.ItemIsEnabled | Qt.ItemFlag.ItemIsEnabled
| QtCore.Qt.ItemIsSelectable | Qt.ItemFlag.ItemIsSelectable
) )
super().flags(index) super().flags(index)

Wyświetl plik

@ -21,8 +21,8 @@ from time import sleep
from typing import List, Tuple from typing import List, Tuple
import numpy as np import numpy as np
from PyQt5 import QtCore, QtWidgets from PyQt6 import QtCore, QtWidgets
from PyQt5.QtCore import pyqtSlot, pyqtSignal from PyQt6.QtCore import pyqtSlot, pyqtSignal
from NanoVNASaver.Calibration import correct_delay from NanoVNASaver.Calibration import correct_delay
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint

Wyświetl plik

@ -21,7 +21,7 @@ import logging
from time import strftime, localtime from time import strftime, localtime
from urllib import request, error from urllib import request, error
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore, QtGui
from NanoVNASaver.About import VERSION_URL, INFO_URL from NanoVNASaver.About import VERSION_URL, INFO_URL
from NanoVNASaver.Version import Version from NanoVNASaver.Version import Version
@ -41,7 +41,7 @@ class AboutWindow(QtWidgets.QWidget):
top_layout = QtWidgets.QHBoxLayout() top_layout = QtWidgets.QHBoxLayout()
make_scrollable(self, top_layout) make_scrollable(self, top_layout)
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
icon_layout = QtWidgets.QVBoxLayout() icon_layout = QtWidgets.QVBoxLayout()
top_layout.addLayout(icon_layout) top_layout.addLayout(icon_layout)

Wyświetl plik

@ -18,7 +18,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore, QtGui
from PyQt6.QtCore import Qt
from NanoVNASaver.Analysis.AntennaAnalysis import MagLoopAnalysis from NanoVNASaver.Analysis.AntennaAnalysis import MagLoopAnalysis
from NanoVNASaver.Analysis.BandPassAnalysis import BandPassAnalysis from NanoVNASaver.Analysis.BandPassAnalysis import BandPassAnalysis
@ -49,7 +50,7 @@ class AnalysisWindow(QtWidgets.QWidget):
self.setWindowTitle("Sweep analysis") self.setWindowTitle("Sweep analysis")
self.setWindowIcon(self.app.icon) self.setWindowIcon(self.app.icon)
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
layout = QtWidgets.QVBoxLayout() layout = QtWidgets.QVBoxLayout()
make_scrollable(self, layout) make_scrollable(self, layout)
@ -96,8 +97,8 @@ class AnalysisWindow(QtWidgets.QWidget):
analysis_box = QtWidgets.QGroupBox("Analysis") analysis_box = QtWidgets.QGroupBox("Analysis")
analysis_box.setSizePolicy( analysis_box.setSizePolicy(
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
) )
self.analysis_layout = QtWidgets.QVBoxLayout(analysis_box) self.analysis_layout = QtWidgets.QVBoxLayout(analysis_box)
@ -126,8 +127,8 @@ class AnalysisWindow(QtWidgets.QWidget):
self.analysis.widget().show() self.analysis.widget().show()
self.update() self.update()
def toggleAutomaticRun(self, state: QtCore.Qt.CheckState): def toggleAutomaticRun(self, state: Qt.CheckState):
if state == QtCore.Qt.Checked: if state == Qt.CheckState.Checked:
self.analysis_list.setDisabled(True) self.analysis_list.setDisabled(True)
self.app.dataAvailable.connect(self.runAnalysis) self.app.dataAvailable.connect(self.runAnalysis)
else: else:

Wyświetl plik

@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore, QtGui
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -31,7 +31,7 @@ class BandsWindow(QtWidgets.QWidget):
self.setWindowTitle("Manage bands") self.setWindowTitle("Manage bands")
self.setWindowIcon(self.app.icon) self.setWindowIcon(self.app.icon)
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
layout = QtWidgets.QVBoxLayout() layout = QtWidgets.QVBoxLayout()
self.setLayout(layout) self.setLayout(layout)

Wyświetl plik

@ -20,7 +20,7 @@
import logging import logging
from functools import partial from functools import partial
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore, QtGui
from NanoVNASaver.Calibration import Calibration from NanoVNASaver.Calibration import Calibration
from NanoVNASaver.Settings.Sweep import SweepMode from NanoVNASaver.Settings.Sweep import SweepMode
@ -51,11 +51,11 @@ class CalibrationWindow(QtWidgets.QWidget):
self.setWindowTitle("Calibration") self.setWindowTitle("Calibration")
self.setWindowIcon(self.app.icon) self.setWindowIcon(self.app.icon)
self.setSizePolicy( self.setSizePolicy(
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Policy.MinimumExpanding,
) )
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
top_layout = QtWidgets.QHBoxLayout() top_layout = QtWidgets.QHBoxLayout()
left_layout = QtWidgets.QVBoxLayout() left_layout = QtWidgets.QVBoxLayout()
@ -106,7 +106,7 @@ class CalibrationWindow(QtWidgets.QWidget):
self.input_offset_delay.setMinimumHeight(20) self.input_offset_delay.setMinimumHeight(20)
self.input_offset_delay.setValue(0) self.input_offset_delay.setValue(0)
self.input_offset_delay.setSuffix(" ps") self.input_offset_delay.setSuffix(" ps")
self.input_offset_delay.setAlignment(QtCore.Qt.AlignRight) self.input_offset_delay.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.input_offset_delay.valueChanged.connect(self.setOffsetDelay) self.input_offset_delay.valueChanged.connect(self.setOffsetDelay)
self.input_offset_delay.setRange(-10e6, 10e6) self.input_offset_delay.setRange(-10e6, 10e6)

Wyświetl plik

@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets from PyQt6 import QtWidgets
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)

Wyświetl plik

@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore, QtGui
from NanoVNASaver.Windows.Defaults import make_scrollable from NanoVNASaver.Windows.Defaults import make_scrollable
from NanoVNASaver.Windows.Screenshot import ScreenshotWindow from NanoVNASaver.Windows.Screenshot import ScreenshotWindow
@ -34,7 +34,7 @@ class DeviceSettingsWindow(QtWidgets.QWidget):
self.setWindowTitle("Device settings") self.setWindowTitle("Device settings")
self.setWindowIcon(self.app.icon) self.setWindowIcon(self.app.icon)
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
self.label = { self.label = {
"status": QtWidgets.QLabel("Not connected."), "status": QtWidgets.QLabel("Not connected."),

Wyświetl plik

@ -19,7 +19,8 @@
import logging import logging
from typing import List from typing import List
from PyQt5 import QtWidgets, QtCore, QtGui from PyQt6 import QtWidgets, QtCore, QtGui
from PyQt6.QtGui import QColorConstants
from NanoVNASaver import Defaults from NanoVNASaver import Defaults
from NanoVNASaver.Charts.Chart import Chart, ChartColors from NanoVNASaver.Charts.Chart import Chart, ChartColors
@ -41,7 +42,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.marker_window = MarkerSettingsWindow(self.app) self.marker_window = MarkerSettingsWindow(self.app)
self.callback_params = {} self.callback_params = {}
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
layout = QtWidgets.QHBoxLayout() layout = QtWidgets.QHBoxLayout()
make_scrollable(self, layout) make_scrollable(self, layout)
@ -95,7 +96,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.pointSizeInput.setMinimum(1) self.pointSizeInput.setMinimum(1)
self.pointSizeInput.setMaximum(10) self.pointSizeInput.setMaximum(10)
self.pointSizeInput.setSuffix(" px") self.pointSizeInput.setSuffix(" px")
self.pointSizeInput.setAlignment(QtCore.Qt.AlignRight) self.pointSizeInput.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.pointSizeInput.valueChanged.connect(self.changePointSize) self.pointSizeInput.valueChanged.connect(self.changePointSize)
display_options_layout.addRow("Point size", self.pointSizeInput) display_options_layout.addRow("Point size", self.pointSizeInput)
@ -107,7 +108,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.lineThicknessInput.setMinimum(1) self.lineThicknessInput.setMinimum(1)
self.lineThicknessInput.setMaximum(10) self.lineThicknessInput.setMaximum(10)
self.lineThicknessInput.setSuffix(" px") self.lineThicknessInput.setSuffix(" px")
self.lineThicknessInput.setAlignment(QtCore.Qt.AlignRight) self.lineThicknessInput.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.lineThicknessInput.valueChanged.connect(self.changeLineThickness) self.lineThicknessInput.valueChanged.connect(self.changeLineThickness)
display_options_layout.addRow("Line thickness", self.lineThicknessInput) display_options_layout.addRow("Line thickness", self.lineThicknessInput)
@ -119,7 +120,7 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.markerSizeInput.setMaximum(20) self.markerSizeInput.setMaximum(20)
self.markerSizeInput.setSingleStep(2) self.markerSizeInput.setSingleStep(2)
self.markerSizeInput.setSuffix(" px") self.markerSizeInput.setSuffix(" px")
self.markerSizeInput.setAlignment(QtCore.Qt.AlignRight) self.markerSizeInput.setAlignment(QtCore.Qt.AlignmentFlag.AlignRight)
self.markerSizeInput.valueChanged.connect(self.changeMarkerSize) self.markerSizeInput.valueChanged.connect(self.changeMarkerSize)
display_options_layout.addRow("Marker size", self.markerSizeInput) display_options_layout.addRow("Marker size", self.markerSizeInput)
@ -452,7 +453,9 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
self.callback_params[cp] = (setting, attr) self.callback_params[cp] = (setting, attr)
cp.clicked.connect(self.setColor) cp.clicked.connect(self.setColor)
p = cp.palette() p = cp.palette()
p.setColor(QtGui.QPalette.ButtonText, getattr(Chart.color, attr)) p.setColor(
QtGui.QPalette.ColorRole.ButtonText, getattr(Chart.color, attr)
)
cp.setPalette(p) cp.setPalette(p)
return cp return cp
@ -526,13 +529,13 @@ class DisplaySettingsWindow(QtWidgets.QWidget):
def changeDarkMode(self): def changeDarkMode(self):
state = self.dark_mode_option.isChecked() state = self.dark_mode_option.isChecked()
Defaults.cfg.gui.dark_mode = bool(state) Defaults.cfg.gui.dark_mode = bool(state)
Chart.color.foreground = QtGui.QColor(QtCore.Qt.lightGray) Chart.color.foreground = QtGui.QColor(QColorConstants.LightGray)
if state: if state:
Chart.color.background = QtGui.QColor(QtCore.Qt.black) Chart.color.background = QtGui.QColor(QColorConstants.Black)
Chart.color.text = QtGui.QColor(QtCore.Qt.white) Chart.color.text = QtGui.QColor(QColorConstants.White)
else: else:
Chart.color.background = QtGui.QColor(QtCore.Qt.white) Chart.color.background = QtGui.QColor(QColorConstants.White)
Chart.color.text = QtGui.QColor(QtCore.Qt.black) Chart.color.text = QtGui.QColor(QColorConstants.Black)
Chart.color.swr = Chart.color.swr Chart.color.swr = Chart.color.swr
self.updateCharts() self.updateCharts()

Wyświetl plik

@ -18,7 +18,7 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore, QtGui
from NanoVNASaver.Touchstone import Touchstone from NanoVNASaver.Touchstone import Touchstone
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.Windows.Defaults import make_scrollable from NanoVNASaver.Windows.Defaults import make_scrollable
@ -34,7 +34,7 @@ class FilesWindow(QtWidgets.QWidget):
self.setWindowTitle("Files") self.setWindowTitle("Files")
self.setWindowIcon(self.app.icon) self.setWindowIcon(self.app.icon)
self.setMinimumWidth(200) self.setMinimumWidth(200)
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
file_window_layout = QtWidgets.QVBoxLayout() file_window_layout = QtWidgets.QVBoxLayout()
make_scrollable(self, file_window_layout) make_scrollable(self, file_window_layout)

Wyświetl plik

@ -18,7 +18,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtCore, QtGui from PyQt6 import QtWidgets, QtCore, QtGui
from PyQt6.QtCore import Qt
from NanoVNASaver.RFTools import Datapoint from NanoVNASaver.RFTools import Datapoint
from NanoVNASaver.Marker.Widget import Marker from NanoVNASaver.Marker.Widget import Marker
@ -46,7 +47,7 @@ class MarkerSettingsWindow(QtWidgets.QWidget):
self.setWindowTitle("Marker settings") self.setWindowTitle("Marker settings")
self.setWindowIcon(self.app.icon) self.setWindowIcon(self.app.icon)
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.cancelButtonClick) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.cancelButtonClick)
self.exampleMarker = Marker("Example marker") self.exampleMarker = Marker("Example marker")
layout = QtWidgets.QVBoxLayout() layout = QtWidgets.QVBoxLayout()
@ -115,12 +116,12 @@ class MarkerSettingsWindow(QtWidgets.QWidget):
self.exampleMarker.updateLabels(self.exampleData11, self.exampleData21) self.exampleMarker.updateLabels(self.exampleData11, self.exampleData21)
def updateField(self, field: QtGui.QStandardItem): def updateField(self, field: QtGui.QStandardItem):
if field.checkState() == QtCore.Qt.Checked: if field.checkState() == Qt.CheckState.Checked:
if field.data() not in self.currentFieldSelection: if field.data() not in self.currentFieldSelection:
self.currentFieldSelection = [] self.currentFieldSelection = []
for i in range(self.model.rowCount()): for i in range(self.model.rowCount()):
field = self.model.item(i, 0) field = self.model.item(i, 0)
if field.checkState() == QtCore.Qt.Checked: if field.checkState() == Qt.CheckState.Checked:
self.currentFieldSelection.append(field.data()) self.currentFieldSelection.append(field.data())
elif field.data() in self.currentFieldSelection: elif field.data() in self.currentFieldSelection:
self.currentFieldSelection.remove(field.data()) self.currentFieldSelection.remove(field.data())
@ -161,7 +162,7 @@ class MarkerSettingsWindow(QtWidgets.QWidget):
item.setCheckable(True) item.setCheckable(True)
item.setEditable(False) item.setEditable(False)
if label.label_id in self.currentFieldSelection: if label.label_id in self.currentFieldSelection:
item.setCheckState(QtCore.Qt.Checked) item.setCheckState(Qt.CheckState.Checked)
self.model.appendRow(item) self.model.appendRow(item)
self.active_labels_view.setModel(self.model) self.active_labels_view.setModel(self.model)
self.model.itemChanged.connect(self.updateField) self.model.itemChanged.connect(self.updateField)

Wyświetl plik

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from PyQt5 import QtWidgets, QtCore, QtGui from PyQt6 import QtWidgets, QtCore, QtGui
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -30,18 +30,20 @@ class ScreenshotWindow(QtWidgets.QLabel):
self.setWindowTitle("Screenshot") self.setWindowTitle("Screenshot")
# TODO : self.setWindowIcon(self.app.icon) # TODO : self.setWindowIcon(self.app.icon)
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
self.setContextMenuPolicy(QtCore.Qt.ActionsContextMenu) self.setContextMenuPolicy(
QtCore.Qt.ContextMenuPolicy.ActionsContextMenu
)
self.action_original_size = QtWidgets.QAction("Original size") self.action_original_size = QtGui.QAction("Original size")
self.action_original_size.triggered.connect(lambda: self.setScale(1)) self.action_original_size.triggered.connect(lambda: self.setScale(1))
self.action_2x_size = QtWidgets.QAction("2x size") self.action_2x_size = QtGui.QAction("2x size")
self.action_2x_size.triggered.connect(lambda: self.setScale(2)) self.action_2x_size.triggered.connect(lambda: self.setScale(2))
self.action_3x_size = QtWidgets.QAction("3x size") self.action_3x_size = QtGui.QAction("3x size")
self.action_3x_size.triggered.connect(lambda: self.setScale(3)) self.action_3x_size.triggered.connect(lambda: self.setScale(3))
self.action_4x_size = QtWidgets.QAction("4x size") self.action_4x_size = QtGui.QAction("4x size")
self.action_4x_size.triggered.connect(lambda: self.setScale(4)) self.action_4x_size.triggered.connect(lambda: self.setScale(4))
self.action_5x_size = QtWidgets.QAction("5x size") self.action_5x_size = QtGui.QAction("5x size")
self.action_5x_size.triggered.connect(lambda: self.setScale(5)) self.action_5x_size.triggered.connect(lambda: self.setScale(5))
self.addAction(self.action_original_size) self.addAction(self.action_original_size)
@ -49,7 +51,7 @@ class ScreenshotWindow(QtWidgets.QLabel):
self.addAction(self.action_3x_size) self.addAction(self.action_3x_size)
self.addAction(self.action_4x_size) self.addAction(self.action_4x_size)
self.addAction(self.action_5x_size) self.addAction(self.action_5x_size)
self.action_save_screenshot = QtWidgets.QAction("Save image") self.action_save_screenshot = QtGui.QAction("Save image")
self.action_save_screenshot.triggered.connect(self.saveScreenshot) self.action_save_screenshot.triggered.connect(self.saveScreenshot)
self.addAction(self.action_save_screenshot) self.addAction(self.action_save_screenshot)

Wyświetl plik

@ -18,7 +18,8 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import logging import logging
from functools import partial from functools import partial
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore, QtGui
from PyQt6.QtCore import Qt
from NanoVNASaver.Formatting import ( from NanoVNASaver.Formatting import (
format_frequency_short, format_frequency_short,
@ -39,7 +40,7 @@ class SweepSettingsWindow(QtWidgets.QWidget):
self.setWindowTitle("Sweep settings") self.setWindowTitle("Sweep settings")
self.setWindowIcon(self.app.icon) self.setWindowIcon(self.app.icon)
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
layout = QtWidgets.QVBoxLayout() layout = QtWidgets.QVBoxLayout()
make_scrollable(self, layout) make_scrollable(self, layout)
@ -114,7 +115,11 @@ class SweepSettingsWindow(QtWidgets.QWidget):
layout.addRow(label) layout.addRow(label)
checkbox = QtWidgets.QCheckBox("Logarithmic sweep") checkbox = QtWidgets.QCheckBox("Logarithmic sweep")
checkbox.setMinimumHeight(20) checkbox.setMinimumHeight(20)
checkbox.setCheckState(self.app.sweep.properties.logarithmic) checkbox.setCheckState(
Qt.CheckState.Checked
if self.app.sweep.properties.logarithmic
else Qt.CheckState.Unchecked
)
checkbox.toggled.connect( checkbox.toggled.connect(
lambda: self.update_logarithmic(checkbox.isChecked()) lambda: self.update_logarithmic(checkbox.isChecked())
) )
@ -224,12 +229,12 @@ class SweepSettingsWindow(QtWidgets.QWidget):
) )
start = int( start = int(
self.band_list.model() self.band_list.model()
.data(index_start, QtCore.Qt.ItemDataRole) .data(index_start, Qt.ItemDataRole.EditRole)
.value() .value()
) )
stop = int( stop = int(
self.band_list.model() self.band_list.model()
.data(index_stop, QtCore.Qt.ItemDataRole) .data(index_stop, Qt.ItemDataRole.EditRole)
.value() .value()
) )

Wyświetl plik

@ -25,7 +25,7 @@ import numpy as np
from scipy.signal import convolve from scipy.signal import convolve
from scipy.constants import speed_of_light from scipy.constants import speed_of_light
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets, QtCore, QtGui
from NanoVNASaver.Windows.Defaults import make_scrollable from NanoVNASaver.Windows.Defaults import make_scrollable
@ -84,7 +84,7 @@ class TDRWindow(QtWidgets.QWidget):
self.setWindowTitle("TDR") self.setWindowTitle("TDR")
self.setWindowIcon(self.app.icon) self.setWindowIcon(self.app.icon)
QtWidgets.QShortcut(QtCore.Qt.Key_Escape, self, self.hide) QtGui.QShortcut(QtCore.Qt.Key.Key_Escape, self, self.hide)
layout = QtWidgets.QFormLayout() layout = QtWidgets.QFormLayout()
make_scrollable(self, layout) make_scrollable(self, layout)

Wyświetl plik

@ -30,7 +30,7 @@ import argparse
import logging import logging
import sys import sys
from PyQt5 import QtWidgets, QtCore from PyQt6 import QtWidgets
from NanoVNASaver.About import VERSION, INFO from NanoVNASaver.About import VERSION, INFO
from NanoVNASaver.NanoVNASaver import NanoVNASaver from NanoVNASaver.NanoVNASaver import NanoVNASaver
@ -90,7 +90,6 @@ def main():
logger.info("Startup...") logger.info("Startup...")
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
app = QtWidgets.QApplication(sys.argv) app = QtWidgets.QApplication(sys.argv)
window = NanoVNASaver() window = NanoVNASaver()
window.show() window.show()
@ -106,7 +105,7 @@ def main():
window.setReference(t.s11, t.s21, args.ref_file) window.setReference(t.s11, t.s21, args.ref_file)
window.dataUpdated() window.dataUpdated()
try: try:
app.exec_() app.exec()
except BaseException as exc: except BaseException as exc:
logger.exception("%s", exc) logger.exception("%s", exc)
raise exc raise exc