nanovna-saver/src/NanoVNASaver/Analysis/Base.py

60 wiersze
1.8 KiB
Python

# NanoVNASaver
#
# A python program to view and export Touchstone data from a NanoVNA
# Copyright (C) 2019, 2020 Rune B. Broberg
# Copyright (C) 2020ff NanoVNA-Saver Authors
#
# 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 logging
from typing import Dict
from PyQt5 import QtWidgets
logger = logging.getLogger(__name__)
CUTOFF_VALS = (3.0, 6.0, 10.0, 20.0, 60.0)
class QHLine(QtWidgets.QFrame):
def __init__(self):
super().__init__()
self.setFrameShape(QtWidgets.QFrame.HLine)
class Analysis:
def __init__(self, app: QtWidgets.QWidget):
self.app = app
self.label: Dict[str, QtWidgets.QLabel] = {
'titel': QtWidgets.QLabel(),
'result': QtWidgets.QLabel(),
}
self.layout = QtWidgets.QFormLayout()
self._widget = QtWidgets.QWidget()
self._widget.setLayout(self.layout)
def widget(self) -> QtWidgets.QWidget:
return self._widget
def runAnalysis(self):
pass
def reset(self):
for label in self.label.values():
label.clear()
def set_result(self, text):
self.label['result'].setText(text)
def set_titel(self, text):
self.label['titel'].setText(text)