more gui stuff
All checks were successful
Publish Python 🐍 distribution 📦 to PyPI and TestPyPI / Build distribution 📦 (push) Successful in -42s
Publish Python 🐍 distribution 📦 to PyPI and TestPyPI / Publish Python 🐍 distribution 📦 to PyPI (push) Has been skipped

This commit is contained in:
Brendan Haines 2024-12-18 22:52:12 -07:00
parent 98f40179e1
commit 34a4532a02

View File

@ -1,5 +1,6 @@
import sys
from pathlib import Path
from typing import List
import matplotlib as mpl
import numpy as np
@ -13,7 +14,7 @@ from PySide6.QtWidgets import (
QApplication,
QMainWindow,
QMenu,
QMenuBar,
QProgressBar,
QPushButton,
QToolBar,
QVBoxLayout,
@ -34,10 +35,11 @@ class PlotWidget(QWidget):
layout = QVBoxLayout()
self.setLayout(layout)
self.fig = plt.Figure(figsize=(5, 4), dpi=100)
self.fig = plt.Figure(figsize=(5, 4), dpi=100, tight_layout=True)
self.ax = self.fig.add_subplot(111)
self.setup_logmag()
# self.setup_smith()
self.ax.legend(loc="upper right")
canvas = FigureCanvasQTAgg(self.fig)
layout.addWidget(canvas)
@ -51,14 +53,22 @@ class PlotWidget(QWidget):
self.ax.xaxis.set_major_formatter(EngFormatter())
self.ax.set_xlabel("Frequency [Hz]")
def setup_logmag(self):
def setup_logmag(self, ylim: List[float] = [-30, 30]):
self.setup_rect()
self.ax.set_ylim(ylim)
self.ax.set_ylabel("Amplitude [dB]")
def setup_phase(self):
self.setup_rect()
self.ax.set_ylim(-200, 200)
self.ax.set_ylabel("Phase [deg]")
def setup_vswr(self):
self.setup_rect()
self.ax.set_yticks(np.arange(1, 11))
self.ax.set_ylim(1, 10)
self.ax.set_ylabel("VSWR")
def setup_smith(self):
self.ax.grid(False)
self.ax.set_xlim(-1, 1)
@ -105,15 +115,28 @@ class MainWindow(QMainWindow):
menubar.addMenu(menu_calibration)
# Content
window_layout = QVBoxLayout()
prog_sweep = QProgressBar()
prog_sweep.setMinimum(0)
prog_sweep.setMaximum(100)
prog_sweep.setTextVisible(False)
prog_sweep.setValue(50)
window_layout.addWidget(prog_sweep)
# window_widget.se
plot_layout = QVBoxLayout()
# TODO: handle plots properly
for i in range(1):
for i in range(2):
plot0 = PlotWidget()
plot_layout.addWidget(plot0)
plot_widget = QWidget()
plot_widget.setLayout(plot_layout)
window_layout.addWidget(plot_widget)
# Set the central widget of the Window.
widget = QWidget()
widget.setLayout(plot_layout)
widget.setLayout(window_layout)
self.setCentralWidget(widget)
def saveas_config(self):