85 lines
3.8 KiB
Python
85 lines
3.8 KiB
Python
import sys
|
|
|
|
import os
|
|
import pandas as pd
|
|
from PyQt5.QtGui import QIcon, QPixmap
|
|
from PyQt5.QtWidgets import (QWidget, QLabel, QHBoxLayout, QVBoxLayout, QApplication, QMainWindow, QGridLayout,
|
|
QDialog, QDialogButtonBox, QPushButton, QTextEdit, QFrame, QTabWidget, QScrollArea, QLineEdit)
|
|
from PyQt5.QtCore import Qt
|
|
|
|
import numpy as np
|
|
|
|
import matplotlib.pyplot as plt
|
|
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
|
|
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolBar
|
|
from matplotlib.colors import LogNorm, BoundaryNorm
|
|
|
|
import datetime
|
|
|
|
import settings as stg
|
|
|
|
from Translation.constant_string import HORIZONTAL
|
|
from settings import depth_cross_section
|
|
|
|
|
|
class CalibrationConstantKt(QDialog):
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
super(CalibrationConstantKt, self).__init__(parent)
|
|
|
|
self.setGeometry(400, 200, 300, 400)
|
|
|
|
self.setWindowTitle("Calibration constant kt")
|
|
|
|
self.verticalLayout_Main = QVBoxLayout()
|
|
self.setLayout(self.verticalLayout_Main)
|
|
|
|
self.tab = QTabWidget()
|
|
self.verticalLayout_Main.addWidget(self.tab)
|
|
|
|
data_ABS = pd.read_excel("../ABS_calibration_constant_kt.xlsx", header=0, sheet_name=None)
|
|
|
|
for t_index, t_value in enumerate(list(data_ABS.keys())):
|
|
print("t = ", t_index, t_value)
|
|
exec("self.tab_" + str(t_index) + "= QWidget()")
|
|
eval("self.tab.addTab(self.tab_" + str(t_index) + ", '" + str(t_value) + "')")
|
|
|
|
exec("self.verticalLayout_tab_" + str(t_index) + "= QVBoxLayout(self.tab_" + str(t_index) + ")")
|
|
|
|
exec("self.scrollarea_tab_" + str(t_index) + " = QScrollArea(self.tab_" + str(t_index) + ")")
|
|
eval("self.scrollarea_tab_" + str(t_index) + ".setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)")
|
|
eval("self.scrollarea_tab_" + str(t_index) + ".setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)")
|
|
eval("self.scrollarea_tab_" + str(t_index) + ".setWidgetResizable(True)")
|
|
|
|
eval("self.verticalLayout_tab_" + str(t_index) + ".addWidget(self.scrollarea_tab_" + str(t_index) + ")")
|
|
|
|
exec("self.gridLayout_tab_" + str(t_index) + " = QGridLayout(self.scrollarea_tab_" + str(t_index) + ")")
|
|
|
|
exec("self.label_freq_" + str(t_index) + " = QLabel('Frequency')")
|
|
eval("self.gridLayout_tab_" + str(t_index) + ".addWidget(self.label_freq_" + str(t_index) + ", 0, 0, 1, 1, Qt.AlignCenter)")
|
|
exec("self.label_kt_" + str(t_index) + " = QLabel('kt')")
|
|
eval("self.gridLayout_tab_" + str(t_index) + ".addWidget(self.label_kt_" + str(t_index) + ", 0, 1, 1, 1, Qt.AlignCenter)")
|
|
|
|
print(data_ABS[t_value].shape[0])
|
|
print(type(data_ABS[t_value]))
|
|
|
|
for x in range(data_ABS[t_value].shape[0]):
|
|
exec("self.label_freq_" + str(x) + "_ABS_" + str(t_index) + " = QLabel('" + str(data_ABS[t_value].iloc[x][0]) + " MHz')")
|
|
eval("self.gridLayout_tab_" + str(t_index) + ".addWidget(self.label_freq_" + str(x) + "_ABS_" + str(t_index) +
|
|
", " + str(x + 1) + ", 0, 1, 1,Qt.AlignCenter)")
|
|
exec("self.lineEdit_" + str(x) + "_ABS_" + str(t_index) + " = QLineEdit()")
|
|
exec("self.lineEdit_" + str(x) + "_ABS_" + str(t_index) + ".setText('" + str(data_ABS[t_value].iloc[x][1]) + "')")
|
|
exec("self.lineEdit_" + str(x) + "_ABS_" + str(t_index) + ".setMaximumWidth(" + str(100) + ")")
|
|
eval("self.gridLayout_tab_" + str(t_index) + ".addWidget(self.lineEdit_" + str(x) + "_ABS_" + str(t_index) +
|
|
", " + str(x+1) + ", 1, 1, 1, Qt.AlignCenter)")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app = QApplication(sys.argv)
|
|
cal = CalibrationConstantKt()
|
|
cal.show()
|
|
# sys.exit(app.exec_())
|
|
app.exec()
|
|
|