kopia lustrzana https://github.com/NanoVNA-Saver/nanovna-saver
55 wiersze
1.7 KiB
Python
55 wiersze
1.7 KiB
Python
# NanoVNASaver - a python program to view and export Touchstone data from a NanoVNA
|
|
# Copyright (C) 2019. Rune B. Broberg
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
import collections
|
|
from typing import List
|
|
|
|
from PyQt5 import QtWidgets, QtGui, QtCore
|
|
|
|
from .Marker import Marker
|
|
Datapoint = collections.namedtuple('Datapoint', 'freq re im')
|
|
|
|
|
|
class Chart(QtWidgets.QWidget):
|
|
sweepColor = QtCore.Qt.darkYellow
|
|
referenceColor : QtGui.QColor = QtGui.QColor(QtCore.Qt.blue)
|
|
referenceColor.setAlpha(64)
|
|
data : List[Datapoint] = []
|
|
reference : List[Datapoint] = []
|
|
markers: List[Marker] = []
|
|
|
|
def setSweepColor(self, color : QtGui.QColor):
|
|
self.sweepColor = color
|
|
self.update()
|
|
|
|
def setReferenceColor(self, color : QtGui.QColor):
|
|
self.referenceColor = color
|
|
self.update()
|
|
|
|
def setReference(self, data):
|
|
self.reference = data
|
|
self.update()
|
|
|
|
def resetReference(self):
|
|
self.reference = []
|
|
self.update()
|
|
|
|
def setData(self, data):
|
|
self.data = data
|
|
self.update()
|
|
|
|
def setMarkers(self, markers):
|
|
self.markers = markers
|