diff --git a/src/gui_qt/_py/tnmh_dialog.py b/src/gui_qt/_py/tnmh_dialog.py new file mode 100644 index 0000000..612f7ec --- /dev/null +++ b/src/gui_qt/_py/tnmh_dialog.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'src/resources/_ui/tnmh_dialog.ui' +# +# Created by: PyQt5 UI code generator 5.15.9 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_Dialog(object): + def setupUi(self, Dialog): + Dialog.setObjectName("Dialog") + Dialog.resize(1176, 714) + self.gridLayout = QtWidgets.QGridLayout(Dialog) + self.gridLayout.setObjectName("gridLayout") + self.graphicsView = PlotWidget(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.graphicsView.sizePolicy().hasHeightForWidth()) + self.graphicsView.setSizePolicy(sizePolicy) + self.graphicsView.setObjectName("graphicsView") + self.gridLayout.addWidget(self.graphicsView, 0, 3, 1, 1) + self.formLayout = QtWidgets.QFormLayout() + self.formLayout.setObjectName("formLayout") + self.label = QtWidgets.QLabel(Dialog) + self.label.setObjectName("label") + self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label) + self.lineEdit = QtWidgets.QLineEdit(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lineEdit.sizePolicy().hasHeightForWidth()) + self.lineEdit.setSizePolicy(sizePolicy) + self.lineEdit.setObjectName("lineEdit") + self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.lineEdit) + self.label_2 = QtWidgets.QLabel(Dialog) + self.label_2.setObjectName("label_2") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_2) + self.lineEdit_3 = QtWidgets.QLineEdit(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lineEdit_3.sizePolicy().hasHeightForWidth()) + self.lineEdit_3.setSizePolicy(sizePolicy) + self.lineEdit_3.setObjectName("lineEdit_3") + self.formLayout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self.lineEdit_3) + self.label_3 = QtWidgets.QLabel(Dialog) + self.label_3.setObjectName("label_3") + self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_3) + self.lineEdit_2 = QtWidgets.QLineEdit(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lineEdit_2.sizePolicy().hasHeightForWidth()) + self.lineEdit_2.setSizePolicy(sizePolicy) + self.lineEdit_2.setObjectName("lineEdit_2") + self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.lineEdit_2) + self.label_4 = QtWidgets.QLabel(Dialog) + self.label_4.setObjectName("label_4") + self.formLayout.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_4) + self.lineEdit_4 = QtWidgets.QLineEdit(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lineEdit_4.sizePolicy().hasHeightForWidth()) + self.lineEdit_4.setSizePolicy(sizePolicy) + self.lineEdit_4.setObjectName("lineEdit_4") + self.formLayout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.lineEdit_4) + self.gridLayout.addLayout(self.formLayout, 0, 1, 1, 1) + self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) + self.buttonBox.setObjectName("buttonBox") + self.gridLayout.addWidget(self.buttonBox, 1, 3, 1, 1) + self.listWidget = QtWidgets.QListWidget(Dialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.listWidget.sizePolicy().hasHeightForWidth()) + self.listWidget.setSizePolicy(sizePolicy) + self.listWidget.setObjectName("listWidget") + self.gridLayout.addWidget(self.listWidget, 0, 0, 1, 1) + + self.retranslateUi(Dialog) + self.buttonBox.accepted.connect(Dialog.accept) # type: ignore + self.buttonBox.rejected.connect(Dialog.reject) # type: ignore + QtCore.QMetaObject.connectSlotsByName(Dialog) + + def retranslateUi(self, Dialog): + _translate = QtCore.QCoreApplication.translate + Dialog.setWindowTitle(_translate("Dialog", "Dialog")) + self.label.setText(_translate("Dialog", "τg / s")) + self.label_2.setText(_translate("Dialog", "β")) + self.label_3.setText(_translate("Dialog", "ΔH/R / K")) + self.label_4.setText(_translate("Dialog", "x")) +from pyqtgraph import PlotWidget diff --git a/src/gui_qt/dsc/glass_dialog.py b/src/gui_qt/dsc/glass_dialog.py index 260ba2c..14bdb9a 100644 --- a/src/gui_qt/dsc/glass_dialog.py +++ b/src/gui_qt/dsc/glass_dialog.py @@ -1,8 +1,20 @@ -from ..Qt import QtWidgets +from gui_qt.Qt import QtWidgets +from gui_qt._py.tnmh_dialog import Ui_Dialog -class TgCalculator(QtWidgets.QDialog): - def __init__(self, parent=None): +class TgCalculator(QtWidgets.QDialog, Ui_Dialog): + def __init__(self, management, parent=None): super().__init__(parent=parent) + self.setupUi(self) + self._management = management + + print('hello there') + + +if __name__ == '__main__': + app = QtWidgets.QApplication([]) + w = TgCalculator(None) + w.show() + app.exec() diff --git a/src/gui_qt/main/mainwindow.py b/src/gui_qt/main/mainwindow.py index 699ee01..f1a4431 100644 --- a/src/gui_qt/main/mainwindow.py +++ b/src/gui_qt/main/mainwindow.py @@ -16,6 +16,7 @@ from .management import UpperManagement from ..Qt import QtGui, QtPrintSupport from ..data.shift_graphs import QShift from ..data.signaledit import QApodDialog, QBaselineDialog, QPhasedialog +from ..dsc.glass_dialog import TgCalculator from ..fit.result import FitExtension, QFitResult from ..graphs.graphwindow import QGraphWindow from ..graphs.movedialog import QMover @@ -237,7 +238,8 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow): self.action_norm_area.triggered.connect(lambda: self.management.apply('norm', ('area',))) self.action_cut.triggered.connect(lambda: self.management.cut()) - self.actionConcatenate_sets.triggered.connect(lambda : self.management.cat()) + self.actionConcatenate_sets.triggered.connect(lambda: self.management.cat()) + @QtCore.pyqtSlot(name='on_action_open_triggered') def open(self): @@ -1080,5 +1082,6 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow): QtWidgets.QMessageBox.about(self, 'Version', f'Build date of AppImage: {__version__}') @QtCore.pyqtSlot(name='on_actionTNMH_model_triggered') - def calculate_tnmh(self): - print('tnmh') + def show_tg_dialog(self): + dialog = TgCalculator(self.management, parent=self) + dialog.show() diff --git a/src/nmreval/data/dsc.py b/src/nmreval/data/dsc.py index f69dd0f..32f1fb1 100644 --- a/src/nmreval/data/dsc.py +++ b/src/nmreval/data/dsc.py @@ -123,7 +123,4 @@ class DSC(Points): 'mid': (x[midpoint], y[midpoint]), 'end': (x[end], liquid_baseline[end]), 'inflection': (x[inflection], y[inflection]), - 'glass_baseline': np.c_[x, glass_baseline], - 'liquid_baseline': np.c_[x, liquid_baseline], - 'tangent_line': np.c_[x[cut_tangent], tangent_line[cut_tangent]], - } + }, np.c_[x, glass_baseline], np.c_[x, liquid_baseline], np.c_[x[cut_tangent], tangent_line[cut_tangent]] diff --git a/src/resources/_ui/tnmh_dialog.ui b/src/resources/_ui/tnmh_dialog.ui new file mode 100644 index 0000000..ffb3ea3 --- /dev/null +++ b/src/resources/_ui/tnmh_dialog.ui @@ -0,0 +1,163 @@ + + + Dialog + + + + 0 + 0 + 1176 + 714 + + + + Dialog + + + + + + + 0 + 0 + + + + + + + + + + τ<sub>g</sub> / s + + + + + + + + 0 + 0 + + + + + + + + β + + + + + + + + 0 + 0 + + + + + + + + ΔH/R / K + + + + + + + + 0 + 0 + + + + + + + + x + + + + + + + + 0 + 0 + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + 0 + 0 + + + + + + + + + PlotWidget + QGraphicsView +
pyqtgraph
+
+
+ + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + +