From ead97515415c2247a73d2be3566e631b4c9d9610 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Thu, 6 Jul 2023 20:05:10 +0200 Subject: [PATCH] tg dialog clean-up --- src/gui_qt/_py/tnmh_dialog.py | 342 ++++++++------ src/gui_qt/dsc/glass_dialog.py | 102 ++--- src/gui_qt/main/management.py | 54 +-- src/nmreval/fit/result.py | 1 - src/resources/_ui/tnmh_dialog.ui | 750 ++++++++++++++++++------------- 5 files changed, 705 insertions(+), 544 deletions(-) diff --git a/src/gui_qt/_py/tnmh_dialog.py b/src/gui_qt/_py/tnmh_dialog.py index f521032..7581c52 100644 --- a/src/gui_qt/_py/tnmh_dialog.py +++ b/src/gui_qt/_py/tnmh_dialog.py @@ -11,185 +11,243 @@ from PyQt5 import QtCore, QtGui, QtWidgets -class Ui_Wizard(object): - def setupUi(self, Wizard): - Wizard.setObjectName("Wizard") - Wizard.resize(854, 619) - self.wizardPage1 = QtWidgets.QWizardPage() - self.wizardPage1.setObjectName("wizardPage1") - self.gridLayout = QtWidgets.QGridLayout(self.wizardPage1) +class Ui_DSCEvalDialog(object): + def setupUi(self, DSCEvalDialog): + DSCEvalDialog.setObjectName("DSCEvalDialog") + DSCEvalDialog.resize(996, 712) + self.gridLayout = QtWidgets.QGridLayout(DSCEvalDialog) self.gridLayout.setObjectName("gridLayout") - self.treeWidget = QtWidgets.QTreeWidget(self.wizardPage1) - self.treeWidget.setObjectName("treeWidget") - self.treeWidget.headerItem().setText(0, "1") - self.treeWidget.header().setVisible(False) - self.gridLayout.addWidget(self.treeWidget, 2, 0, 1, 1) + self.listWidget = QListWidgetSelect(DSCEvalDialog) + 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.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) + self.listWidget.setObjectName("listWidget") + self.gridLayout.addWidget(self.listWidget, 0, 0, 1, 1) + self.stackedWidget = QtWidgets.QStackedWidget(DSCEvalDialog) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.stackedWidget.sizePolicy().hasHeightForWidth()) + self.stackedWidget.setSizePolicy(sizePolicy) + self.stackedWidget.setFrameShape(QtWidgets.QFrame.Box) + self.stackedWidget.setObjectName("stackedWidget") + self.page = QtWidgets.QWidget() + self.page.setObjectName("page") + self.gridLayout_2 = QtWidgets.QGridLayout(self.page) + self.gridLayout_2.setObjectName("gridLayout_2") self.gridLayout_9 = QtWidgets.QGridLayout() self.gridLayout_9.setObjectName("gridLayout_9") - self.tg_export_check = QtWidgets.QCheckBox(self.wizardPage1) + self.tg_export_check = QtWidgets.QCheckBox(self.page) self.tg_export_check.setChecked(True) self.tg_export_check.setObjectName("tg_export_check") self.gridLayout_9.addWidget(self.tg_export_check, 0, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout_9.addItem(spacerItem, 3, 0, 1, 1) - self.tglines_export_check = QtWidgets.QCheckBox(self.wizardPage1) + self.tglines_export_check = QtWidgets.QCheckBox(self.page) self.tglines_export_check.setChecked(True) self.tglines_export_check.setObjectName("tglines_export_check") self.gridLayout_9.addWidget(self.tglines_export_check, 0, 1, 1, 1) - self.pushButton = QtWidgets.QPushButton(self.wizardPage1) - self.pushButton.setObjectName("pushButton") - self.gridLayout_9.addWidget(self.pushButton, 2, 0, 1, 2) - self.gridLayout.addLayout(self.gridLayout_9, 2, 1, 1, 1) - self.dsc_plot = PlotWidget(self.wizardPage1) + self.tg_export_button = QtWidgets.QPushButton(self.page) + self.tg_export_button.setObjectName("tg_export_button") + self.gridLayout_9.addWidget(self.tg_export_button, 2, 0, 1, 2) + self.gridLayout_2.addLayout(self.gridLayout_9, 2, 1, 1, 1) + self.tg_tree = QtWidgets.QTreeWidget(self.page) + self.tg_tree.setObjectName("tg_tree") + self.tg_tree.headerItem().setText(0, "1") + self.tg_tree.header().setVisible(False) + self.gridLayout_2.addWidget(self.tg_tree, 2, 0, 1, 1) + self.dsc_plot = PlotWidget(self.page) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.dsc_plot.sizePolicy().hasHeightForWidth()) self.dsc_plot.setSizePolicy(sizePolicy) self.dsc_plot.setObjectName("dsc_plot") - self.gridLayout.addWidget(self.dsc_plot, 1, 0, 1, 2) - self.calctg_button = QtWidgets.QToolButton(self.wizardPage1) + self.gridLayout_2.addWidget(self.dsc_plot, 1, 0, 1, 2) + self.horizontalLayout_4 = QtWidgets.QHBoxLayout() + self.horizontalLayout_4.setObjectName("horizontalLayout_4") + self.label = QtWidgets.QLabel(self.page) + self.label.setObjectName("label") + self.horizontalLayout_4.addWidget(self.label) + self.calctg_button = QtWidgets.QPushButton(self.page) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.calctg_button.sizePolicy().hasHeightForWidth()) self.calctg_button.setSizePolicy(sizePolicy) - self.calctg_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) - self.calctg_button.setArrowType(QtCore.Qt.RightArrow) self.calctg_button.setObjectName("calctg_button") - self.gridLayout.addWidget(self.calctg_button, 0, 0, 1, 2) - Wizard.addPage(self.wizardPage1) - self.wizardPage2 = QtWidgets.QWizardPage() - self.wizardPage2.setObjectName("wizardPage2") - self.gridLayout_2 = QtWidgets.QGridLayout(self.wizardPage2) - self.gridLayout_2.setObjectName("gridLayout_2") - self.toolButton = QtWidgets.QToolButton(self.wizardPage2) - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.toolButton.sizePolicy().hasHeightForWidth()) - self.toolButton.setSizePolicy(sizePolicy) - self.toolButton.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) - self.toolButton.setArrowType(QtCore.Qt.RightArrow) - self.toolButton.setObjectName("toolButton") - self.gridLayout_2.addWidget(self.toolButton, 0, 0, 1, 2) - self.tghodge_graph = PlotWidget(self.wizardPage2) + self.horizontalLayout_4.addWidget(self.calctg_button) + self.gridLayout_2.addLayout(self.horizontalLayout_4, 0, 0, 1, 2) + self.stackedWidget.addWidget(self.page) + self.page_2 = QtWidgets.QWidget() + self.page_2.setObjectName("page_2") + self.gridLayout_3 = QtWidgets.QGridLayout(self.page_2) + self.gridLayout_3.setObjectName("gridLayout_3") + self.label_4 = QtWidgets.QLabel(self.page_2) + self.label_4.setObjectName("label_4") + self.gridLayout_3.addWidget(self.label_4, 2, 0, 1, 1) + self.tghodge_graph = PlotWidget(self.page_2) self.tghodge_graph.setObjectName("tghodge_graph") - self.gridLayout_2.addWidget(self.tghodge_graph, 2, 0, 1, 1) - self.tau_plot = PlotWidget(self.wizardPage2) + self.gridLayout_3.addWidget(self.tghodge_graph, 1, 0, 1, 1) + self.tau_plot = PlotWidget(self.page_2) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.tau_plot.sizePolicy().hasHeightForWidth()) self.tau_plot.setSizePolicy(sizePolicy) self.tau_plot.setObjectName("tau_plot") - self.gridLayout_2.addWidget(self.tau_plot, 2, 1, 1, 1) - self.gridLayout_4 = QtWidgets.QGridLayout() - self.gridLayout_4.setObjectName("gridLayout_4") - self.checkBox_6 = QtWidgets.QCheckBox(self.wizardPage2) - self.checkBox_6.setChecked(True) - self.checkBox_6.setObjectName("checkBox_6") - self.gridLayout_4.addWidget(self.checkBox_6, 2, 0, 1, 1) - self.new_graph_tau_check = QtWidgets.QCheckBox(self.wizardPage2) - self.new_graph_tau_check.setChecked(True) - self.new_graph_tau_check.setObjectName("new_graph_tau_check") - self.gridLayout_4.addWidget(self.new_graph_tau_check, 0, 1, 1, 1) - self.checkBox_7 = QtWidgets.QCheckBox(self.wizardPage2) - self.checkBox_7.setChecked(True) - self.checkBox_7.setObjectName("checkBox_7") - self.gridLayout_4.addWidget(self.checkBox_7, 4, 0, 1, 1) - self.checkBox_5 = QtWidgets.QCheckBox(self.wizardPage2) - self.checkBox_5.setChecked(True) - self.checkBox_5.setObjectName("checkBox_5") - self.gridLayout_4.addWidget(self.checkBox_5, 3, 0, 1, 1) - self.new_graph_tau_combo = QtWidgets.QComboBox(self.wizardPage2) - self.new_graph_tau_combo.setEnabled(False) - self.new_graph_tau_combo.setObjectName("new_graph_tau_combo") - self.gridLayout_4.addWidget(self.new_graph_tau_combo, 0, 2, 1, 1) - self.checkBox_4 = QtWidgets.QCheckBox(self.wizardPage2) - self.checkBox_4.setChecked(True) - self.checkBox_4.setObjectName("checkBox_4") - self.gridLayout_4.addWidget(self.checkBox_4, 1, 0, 1, 1) - self.checkBox = QtWidgets.QCheckBox(self.wizardPage2) - self.checkBox.setChecked(True) - self.checkBox.setObjectName("checkBox") - self.gridLayout_4.addWidget(self.checkBox, 0, 0, 1, 1) - self.pushButton_4 = QtWidgets.QPushButton(self.wizardPage2) - self.pushButton_4.setObjectName("pushButton_4") - self.gridLayout_4.addWidget(self.pushButton_4, 4, 1, 1, 2) - self.gridLayout_2.addLayout(self.gridLayout_4, 3, 0, 1, 2) - Wizard.addPage(self.wizardPage2) - self.wizardPage = QtWidgets.QWizardPage() - sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.MinimumExpanding) + self.gridLayout_3.addWidget(self.tau_plot, 1, 1, 1, 1) + self.horizontalLayout_3 = QtWidgets.QHBoxLayout() + self.horizontalLayout_3.setObjectName("horizontalLayout_3") + self.label_2 = QtWidgets.QLabel(self.page_2) + self.label_2.setObjectName("label_2") + self.horizontalLayout_3.addWidget(self.label_2) + self.hodge_button = QtWidgets.QPushButton(self.page_2) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.wizardPage.sizePolicy().hasHeightForWidth()) - self.wizardPage.setSizePolicy(sizePolicy) - self.wizardPage.setSubTitle("") - self.wizardPage.setObjectName("wizardPage") - self.gridLayout_6 = QtWidgets.QGridLayout(self.wizardPage) + sizePolicy.setHeightForWidth(self.hodge_button.sizePolicy().hasHeightForWidth()) + self.hodge_button.setSizePolicy(sizePolicy) + self.hodge_button.setObjectName("hodge_button") + self.horizontalLayout_3.addWidget(self.hodge_button) + self.gridLayout_3.addLayout(self.horizontalLayout_3, 0, 0, 1, 2) + self.export_hodge_button = QtWidgets.QPushButton(self.page_2) + self.export_hodge_button.setObjectName("export_hodge_button") + self.gridLayout_3.addWidget(self.export_hodge_button, 5, 1, 1, 1) + self.hodge_graph_combo = QtWidgets.QComboBox(self.page_2) + self.hodge_graph_combo.setEnabled(False) + self.hodge_graph_combo.setObjectName("hodge_graph_combo") + self.gridLayout_3.addWidget(self.hodge_graph_combo, 4, 1, 1, 1) + self.hodge_graph_check = QtWidgets.QCheckBox(self.page_2) + self.hodge_graph_check.setChecked(True) + self.hodge_graph_check.setObjectName("hodge_graph_check") + self.gridLayout_3.addWidget(self.hodge_graph_check, 4, 0, 1, 1) + self.horizontalLayout_5 = QtWidgets.QHBoxLayout() + self.horizontalLayout_5.setObjectName("horizontalLayout_5") + self.onset_check = QtWidgets.QCheckBox(self.page_2) + self.onset_check.setChecked(True) + self.onset_check.setObjectName("onset_check") + self.horizontalLayout_5.addWidget(self.onset_check) + self.mid_check = QtWidgets.QCheckBox(self.page_2) + self.mid_check.setChecked(True) + self.mid_check.setObjectName("mid_check") + self.horizontalLayout_5.addWidget(self.mid_check) + self.end_check = QtWidgets.QCheckBox(self.page_2) + self.end_check.setChecked(True) + self.end_check.setObjectName("end_check") + self.horizontalLayout_5.addWidget(self.end_check) + self.inflection_check = QtWidgets.QCheckBox(self.page_2) + self.inflection_check.setChecked(True) + self.inflection_check.setObjectName("inflection_check") + self.horizontalLayout_5.addWidget(self.inflection_check) + self.fictive_check = QtWidgets.QCheckBox(self.page_2) + self.fictive_check.setChecked(True) + self.fictive_check.setObjectName("fictive_check") + self.horizontalLayout_5.addWidget(self.fictive_check) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_5.addItem(spacerItem1) + self.gridLayout_3.addLayout(self.horizontalLayout_5, 3, 0, 1, 2) + self.stackedWidget.addWidget(self.page_2) + self.page_3 = QtWidgets.QWidget() + self.page_3.setObjectName("page_3") + self.gridLayout_6 = QtWidgets.QGridLayout(self.page_3) self.gridLayout_6.setObjectName("gridLayout_6") - self.fit_tnhm_fitbutton = QtWidgets.QPushButton(self.wizardPage) - self.fit_tnhm_fitbutton.setObjectName("fit_tnhm_fitbutton") - self.gridLayout_6.addWidget(self.fit_tnhm_fitbutton, 0, 0, 1, 2) - self.treeWidget_2 = QtWidgets.QTreeWidget(self.wizardPage) - self.treeWidget_2.setObjectName("treeWidget_2") - self.treeWidget_2.headerItem().setText(0, "1") - self.treeWidget_2.header().setVisible(False) - self.gridLayout_6.addWidget(self.treeWidget_2, 2, 0, 1, 1) + self.tnmh_graphics = PlotWidget(self.page_3) + self.tnmh_graphics.setObjectName("tnmh_graphics") + self.gridLayout_6.addWidget(self.tnmh_graphics, 1, 0, 1, 2) + self.tnmh_tree = QtWidgets.QTreeWidget(self.page_3) + self.tnmh_tree.setObjectName("tnmh_tree") + self.tnmh_tree.headerItem().setText(0, "1") + self.tnmh_tree.header().setVisible(False) + self.gridLayout_6.addWidget(self.tnmh_tree, 2, 0, 1, 1) self.gridLayout_5 = QtWidgets.QGridLayout() self.gridLayout_5.setObjectName("gridLayout_5") - self.new_graph_tnmh_check_2 = QtWidgets.QCheckBox(self.wizardPage) - self.new_graph_tnmh_check_2.setChecked(True) - self.new_graph_tnmh_check_2.setObjectName("new_graph_tnmh_check_2") - self.gridLayout_5.addWidget(self.new_graph_tnmh_check_2, 1, 0, 1, 1) - self.checkBox_14 = QtWidgets.QCheckBox(self.wizardPage) - self.checkBox_14.setChecked(True) - self.checkBox_14.setObjectName("checkBox_14") - self.gridLayout_5.addWidget(self.checkBox_14, 0, 0, 1, 1) - self.pushButton_2 = QtWidgets.QPushButton(self.wizardPage) - self.pushButton_2.setObjectName("pushButton_2") - self.gridLayout_5.addWidget(self.pushButton_2, 2, 0, 1, 2) - self.checkBox_13 = QtWidgets.QCheckBox(self.wizardPage) - self.checkBox_13.setChecked(True) - self.checkBox_13.setObjectName("checkBox_13") - self.gridLayout_5.addWidget(self.checkBox_13, 0, 1, 1, 1) - self.new_graph_tnmh_combo_2 = QtWidgets.QComboBox(self.wizardPage) - self.new_graph_tnmh_combo_2.setEnabled(False) - self.new_graph_tnmh_combo_2.setObjectName("new_graph_tnmh_combo_2") - self.gridLayout_5.addWidget(self.new_graph_tnmh_combo_2, 1, 1, 1, 1) - spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) - self.gridLayout_5.addItem(spacerItem1, 3, 0, 1, 1) + self.tnmh_graph_check = QtWidgets.QCheckBox(self.page_3) + self.tnmh_graph_check.setChecked(True) + self.tnmh_graph_check.setObjectName("tnmh_graph_check") + self.gridLayout_5.addWidget(self.tnmh_graph_check, 1, 0, 1, 1) + self.tnmhfit_export_check = QtWidgets.QCheckBox(self.page_3) + self.tnmhfit_export_check.setChecked(True) + self.tnmhfit_export_check.setObjectName("tnmhfit_export_check") + self.gridLayout_5.addWidget(self.tnmhfit_export_check, 0, 0, 1, 1) + self.tnmh_export_button = QtWidgets.QPushButton(self.page_3) + self.tnmh_export_button.setObjectName("tnmh_export_button") + self.gridLayout_5.addWidget(self.tnmh_export_button, 2, 0, 1, 2) + self.fictive_export_check = QtWidgets.QCheckBox(self.page_3) + self.fictive_export_check.setChecked(True) + self.fictive_export_check.setObjectName("fictive_export_check") + self.gridLayout_5.addWidget(self.fictive_export_check, 0, 1, 1, 1) + self.tnmh_graph_combo = QtWidgets.QComboBox(self.page_3) + self.tnmh_graph_combo.setEnabled(False) + self.tnmh_graph_combo.setObjectName("tnmh_graph_combo") + self.gridLayout_5.addWidget(self.tnmh_graph_combo, 1, 1, 1, 1) + spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.gridLayout_5.addItem(spacerItem2, 3, 0, 1, 1) self.gridLayout_6.addLayout(self.gridLayout_5, 2, 1, 1, 1) - self.graphicsView_3 = PlotWidget(self.wizardPage) - self.graphicsView_3.setObjectName("graphicsView_3") - self.gridLayout_6.addWidget(self.graphicsView_3, 1, 0, 1, 2) - Wizard.addPage(self.wizardPage) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + self.label_3 = QtWidgets.QLabel(self.page_3) + self.label_3.setObjectName("label_3") + self.horizontalLayout_2.addWidget(self.label_3) + self.tnhm_fitbutton = QtWidgets.QPushButton(self.page_3) + self.tnhm_fitbutton.setObjectName("tnhm_fitbutton") + self.horizontalLayout_2.addWidget(self.tnhm_fitbutton) + self.gridLayout_6.addLayout(self.horizontalLayout_2, 0, 0, 1, 2) + self.stackedWidget.addWidget(self.page_3) + self.gridLayout.addWidget(self.stackedWidget, 0, 1, 1, 1) + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout.addItem(spacerItem3) + self.back_button = QtWidgets.QToolButton(DSCEvalDialog) + self.back_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) + self.back_button.setArrowType(QtCore.Qt.LeftArrow) + self.back_button.setObjectName("back_button") + self.horizontalLayout.addWidget(self.back_button) + self.next_button = QtWidgets.QToolButton(DSCEvalDialog) + self.next_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon) + self.next_button.setArrowType(QtCore.Qt.RightArrow) + self.next_button.setObjectName("next_button") + self.horizontalLayout.addWidget(self.next_button) + self.close_button = QtWidgets.QPushButton(DSCEvalDialog) + self.close_button.setObjectName("close_button") + self.horizontalLayout.addWidget(self.close_button) + self.gridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 2) - self.retranslateUi(Wizard) - QtCore.QMetaObject.connectSlotsByName(Wizard) + self.retranslateUi(DSCEvalDialog) + self.stackedWidget.setCurrentIndex(0) + self.close_button.clicked.connect(DSCEvalDialog.close) # type: ignore + QtCore.QMetaObject.connectSlotsByName(DSCEvalDialog) - def retranslateUi(self, Wizard): + def retranslateUi(self, DSCEvalDialog): _translate = QtCore.QCoreApplication.translate - Wizard.setWindowTitle(_translate("Wizard", "Wizard")) - self.wizardPage1.setTitle(_translate("Wizard", "Glass transition")) - self.tg_export_check.setText(_translate("Wizard", "Export Tg")) - self.tglines_export_check.setText(_translate("Wizard", "Export lines")) - self.pushButton.setText(_translate("Wizard", "Export")) - self.calctg_button.setText(_translate("Wizard", "Calculate Tg")) - self.wizardPage2.setTitle(_translate("Wizard", "Hodge")) - self.toolButton.setText(_translate("Wizard", "Calculate Hodge")) - self.checkBox_6.setText(_translate("Wizard", "End")) - self.new_graph_tau_check.setText(_translate("Wizard", "New graph")) - self.checkBox_7.setText(_translate("Wizard", "Fictive")) - self.checkBox_5.setText(_translate("Wizard", "Inflection")) - self.checkBox_4.setText(_translate("Wizard", "Midpoint")) - self.checkBox.setText(_translate("Wizard", "Onset")) - self.pushButton_4.setText(_translate("Wizard", "Export")) - self.wizardPage.setTitle(_translate("Wizard", "TNMH")) - self.fit_tnhm_fitbutton.setText(_translate("Wizard", "Fit TNMH model")) - self.new_graph_tnmh_check_2.setText(_translate("Wizard", "New graph")) - self.checkBox_14.setText(_translate("Wizard", "Export fit")) - self.pushButton_2.setText(_translate("Wizard", "Export")) - self.checkBox_13.setText(_translate("Wizard", "Export dTf / dT")) + DSCEvalDialog.setWindowTitle(_translate("DSCEvalDialog", "To boldly go where no man has gone before")) + self.tg_export_check.setText(_translate("DSCEvalDialog", "Export Tg")) + self.tglines_export_check.setText(_translate("DSCEvalDialog", "Export lines")) + self.tg_export_button.setText(_translate("DSCEvalDialog", "Export")) + self.label.setText(_translate("DSCEvalDialog", "

Glass transition

")) + self.calctg_button.setText(_translate("DSCEvalDialog", "Calculate Tg")) + self.label_4.setText(_translate("DSCEvalDialog", "Export tau:")) + self.label_2.setText(_translate("DSCEvalDialog", "

Hodge tau

")) + self.hodge_button.setText(_translate("DSCEvalDialog", "Make it so.")) + self.export_hodge_button.setText(_translate("DSCEvalDialog", "Export")) + self.hodge_graph_check.setText(_translate("DSCEvalDialog", "New graph")) + self.onset_check.setText(_translate("DSCEvalDialog", "Onset")) + self.mid_check.setText(_translate("DSCEvalDialog", "Midpoint")) + self.end_check.setText(_translate("DSCEvalDialog", "End")) + self.inflection_check.setText(_translate("DSCEvalDialog", "Inflection")) + self.fictive_check.setText(_translate("DSCEvalDialog", "Fictive")) + self.tnmh_graph_check.setText(_translate("DSCEvalDialog", "New graph")) + self.tnmhfit_export_check.setText(_translate("DSCEvalDialog", "Export fit")) + self.tnmh_export_button.setText(_translate("DSCEvalDialog", "Export")) + self.fictive_export_check.setText(_translate("DSCEvalDialog", "Export dTf / dT")) + self.label_3.setText(_translate("DSCEvalDialog", "

dTf/dT and TNMH

")) + self.tnhm_fitbutton.setText(_translate("DSCEvalDialog", "Engage!")) + self.back_button.setText(_translate("DSCEvalDialog", "Back")) + self.next_button.setText(_translate("DSCEvalDialog", "Next")) + self.close_button.setText(_translate("DSCEvalDialog", "Close")) +from ..lib.listwidget import QListWidgetSelect from pyqtgraph import PlotWidget diff --git a/src/gui_qt/dsc/glass_dialog.py b/src/gui_qt/dsc/glass_dialog.py index 0862cf0..4cac3c0 100644 --- a/src/gui_qt/dsc/glass_dialog.py +++ b/src/gui_qt/dsc/glass_dialog.py @@ -1,31 +1,24 @@ -import pprint from itertools import cycle from numpy import array, nan, isnan -from pyqtgraph import mkPen, mkBrush, LegendItem +from pyqtgraph import mkPen, mkBrush from nmreval.dsc.hodge import tau_hodge from nmreval.lib.colors import Tab10 -from ..Qt import QtWidgets, QtCore, QtGui -from .._py.tnmh_dialog import Ui_Wizard -from ..lib.listwidget import QListWidgetSelect +from ..Qt import QtWidgets, QtCore +from .._py.tnmh_dialog import Ui_DSCEvalDialog from ..lib.pg_objects import PlotItem, RegionItem from nmreval.data import DSC, Points -class TgCalculator(QtWidgets.QWizard, Ui_Wizard): +class TgCalculator(QtWidgets.QWizard, Ui_DSCEvalDialog): newData = QtCore.pyqtSignal(dict, str) def __init__(self, management, parent=None): super().__init__(parent=parent) self.setupUi(self) - self.listWidget = QListWidgetSelect(parent=self) - self.listWidget.setSelectionMode(self.listWidget.ExtendedSelection) - self.listWidget.itemChanged.connect(self.change_visibility) - self.setSideWidget(self.listWidget) - self.listWidget.setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.MinimumExpanding)) self._management = management self._colors = cycle(Tab10) @@ -87,8 +80,11 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): self.add_sets() - self.new_graph_tau_check.stateChanged.connect(lambda state: self.new_graph_tau_combo.setEnabled(not bool(state))) - self.new_graph_tau_check.stateChanged.connect(lambda state: self.new_graph_tnmh_combo_2.setEnabled(not bool(state))) + self.tnmh_graph_check.stateChanged.connect(lambda state: self.tnmh_graph_combo.setEnabled(not bool(state))) + self.hodge_graph_check.stateChanged.connect(lambda state: self.hodge_graph_combo.setEnabled(not bool(state))) + + self.next_button.clicked.connect(lambda: self.stackedWidget.setCurrentIndex((self.stackedWidget.currentIndex() + 1) % 3)) + self.back_button.clicked.connect(lambda: self.stackedWidget.setCurrentIndex((self.stackedWidget.currentIndex() + 2) % 3)) def __call__(self): self.clear() @@ -99,9 +95,13 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): def clear(self): self.listWidget.clear() + self.tg_tree.clear() + self.tnmh_tree.clear() + for plots in self._plots.values(): for val in plots: self.dsc_plot.removeItem(val) + self.tnmh_graphics.removeItem(val) for key, plt in self._hodge.items(): plt[0].setData(x=[], y=[]) @@ -115,11 +115,13 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): self._lines = {} self._fit = {} + self.stackedWidget.setCurrentIndex(0) + def add_sets(self): - self.new_graph_tau_combo.clear() - for graphs in self._management.graphs.list(): - self.new_graph_tau_combo.addItem(graphs[1], userData=graphs[0]) - self.new_graph_tnmh_combo_2.addItem(graphs[1], userData=graphs[0]) + for w in (self.tnmh_graph_combo, self.hodge_graph_combo): + w.clear() + for graphs in self._management.graphs.list(): + w.addItem(graphs[1], userData=graphs[0]) min_x = 10_000_000 max_x = -10_000_000 @@ -158,11 +160,11 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): self.dsc_plot.addItem(tg_plot) fictive_cp = PlotItem(pen=mkPen(c.rgb())) - self.graphicsView_3.addItem(fictive_cp) + self.tnmh_graphics.addItem(fictive_cp) tnmh_fit = PlotItem() tnmh_fit.set_line(style=2, color=c) - self.graphicsView_3.addItem(tnmh_fit) + self.tnmh_graphics.addItem(tnmh_fit) self._plots[key] = (data_plot, tg_plot, glass, liquid, tangent, fictive_cp, tnmh_fit) self._tg_value[key] = { @@ -173,7 +175,7 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): # 'fictive': (nan, nan), } - if self._limitless: + if self._limitless and max_x != -10000000 and min_x != 10000000 : dist = max_x - min_x self.limits[0].setRegion((min_x, min_x+min(0.1*dist, 5))) self.limits[1].setRegion((max_x-min(5, 0.1*dist), max_x)) @@ -205,7 +207,7 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): self._update_tg_plots() def _update_tg_plots(self): - self.treeWidget.clear() + self.tg_tree.clear() for idx in range(self.listWidget.count()): item = self.listWidget.item(idx) @@ -217,7 +219,7 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): child_item = QtWidgets.QTreeWidgetItem([f'{name.capitalize()}: {pos[0]:.2f} K']) tree_item.addChild(child_item) - self.treeWidget.addTopLevelItem(tree_item) + self.tg_tree.addTopLevelItem(tree_item) key = item.data(QtCore.Qt.UserRole) plot = self._plots[key] @@ -225,7 +227,7 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): plot[1].setData(array(list(self._tg_value[key].values()))) - @QtCore.pyqtSlot(name='on_pushButton_clicked') + @QtCore.pyqtSlot(name='on_tg_export_button_clicked') def export_tg(self): ret_dic = {} for key, tg in self._tg_value.items(): @@ -236,10 +238,9 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): else: tg_pts = None + line = [] if self.tglines_export_check.isChecked(): - line = self._lines[key] - else: - line = [] + line = self._lines.get(key, []) ret_dic[key] = (tg_pts, line) @@ -263,13 +264,13 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): return cp - @QtCore.pyqtSlot(name='on_fit_tnhm_fitbutton_clicked') + @QtCore.pyqtSlot(name='on_tnhm_fitbutton_clicked') def make_tnmh(self): baselines = tuple(lim.getRegion() for lim in self.limits) if baselines[0][0] > baselines[1][0]: baselines = baselines[1], baselines[0] - self.treeWidget_2.clear() + self.tnmh_tree.clear() for idx in range(self.listWidget.count()): item = self.listWidget.item(idx) if item.checkState() == QtCore.Qt.Unchecked: @@ -295,9 +296,9 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): child_item = QtWidgets.QTreeWidgetItem([values.parameter_string()]) tree_item.addChild(child_item) - self.treeWidget_2.addTopLevelItem(tree_item) + self.tnmh_tree.addTopLevelItem(tree_item) - @QtCore.pyqtSlot(name='on_pushButton_2_clicked') + @QtCore.pyqtSlot(name='on_tnmh_export_button_clicked') def export_tnmh(self): ret_dic = {} for idx in range(self.listWidget.count()): @@ -306,26 +307,23 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): continue key = item.data(QtCore.Qt.UserRole) - if self.checkBox_13.isChecked(): - _, cp = self._dsc[key] - else: - cp = None - if self.checkBox_14.isChecked(): - line = self._fit[key] - else: - line = None + cp = None + if self.fictive_export_check.isChecked(): + _, cp = self._dsc[key] + + line = None + + if self.tnmhfit_export_check.isChecked(): + line = self._fit.get(key) ret_dic[key] = (cp, line) - if self.new_graph_tnmh_check_2.isChecked(): - ret_dic['graph'] = '' - else: - ret_dic['graph'] = self.new_graph_tnmh_combo_2.currentData() + ret_dic['graph'] = '' if self.tnmh_graph_check.isChecked() else self.tnmh_graph_combo.currentData() self.newData.emit(ret_dic, 'tnmh') - @QtCore.pyqtSlot(name='on_toolButton_clicked') + @QtCore.pyqtSlot(name='on_hodge_button_clicked') def hodge(self): for tg_type, (plot, data, fitplots, fit) in self._hodge.items(): @@ -355,27 +353,21 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard): self._hodge[tg_type] = (plot, data, fitplots, fit) - @QtCore.pyqtSlot(name='on_pushButton_4_clicked') + @QtCore.pyqtSlot(name='on_export_hodge_button_clicked') def export_hodge(self): - ret_dic2 = {} + ret_dic = {} - for cb in (self.checkBox, self.checkBox_4, self.checkBox_6, self.checkBox_5, self.checkBox_7): + for cb in (self.onset_check, self.mid_check, self.end_check, self.inflection_check, self.fictive_check): if cb.isChecked(): item = cb.text().lower() data = self._hodge.get(item) if data[1] is not None: - ret_dic2[item] = data[1] + ret_dic[item] = data[1] - if self.new_graph_tau_check.isChecked(): - ret_dic2['graph'] = '' - else: - ret_dic2['graph'] = self.new_graph_tau_combo.currentData() + ret_dic['graph'] = '' if self.hodge_graph_check.isChecked() else self.hodge_graph_combo.currentData() - self.newData.emit(ret_dic2, 'hodge') + self.newData.emit(ret_dic, 'hodge') def close(self) -> bool: self.clear() return super().close() - - def accept(self) -> None: - self.close() diff --git a/src/gui_qt/main/management.py b/src/gui_qt/main/management.py index 45b8339..de40a3a 100644 --- a/src/gui_qt/main/management.py +++ b/src/gui_qt/main/management.py @@ -774,50 +774,36 @@ class UpperManagement(QtCore.QObject): self.newData.emit(new_data, self.current_graph) @QtCore.pyqtSlot(dict, str) - def addTg(self, dic1: dict, dtype: str): - if dtype == 'tg': - for k, (tg, lines) in dic1.items(): + def addTg(self, dic: dict, dtype: str): + graph_id = self.current_graph if dtype == 'tg' else dic.pop('graph') + + set_id_list = [] + + if dtype == 'hodge': + for v in dic.values(): + set_id_list.append(self.add(v)) + + else: + for k, (data, lines) in dic.items(): p: ExperimentContainer = self[k] col = p.plot_real.linecolor - tg_data_id = [] + if data is not None: + set_id_list.append(self.add(data, color=col)) - if tg is not None: - tg_data_id.append(self.add(tg, color=col)) + if dtype == 'tnmh': + if lines is not None: + lines = [lines] + else: + lines = [] for line in lines: set_id = self.add(line, color=col) self[set_id].setLine(style=LineStyle.Dashed) self[set_id].setSymbol(symbol=SymbolStyle.No) - tg_data_id.append(set_id) + set_id_list.append(set_id) - self.newData.emit(tg_data_id, self.current_graph) - - elif dtype == 'hodge': - set_id_list = [] - graph_id = dic1.pop('graph') - for v in dic1.values(): - set_id_list.append(self.add(v)) - self.newData.emit(set_id_list, graph_id) - - elif dtype == 'tnmh': - set_id_list = [] - graph_id = dic1.pop('graph') - for k, (tg, fit) in dic1.items(): - p: ExperimentContainer = self[k] - col = p.plot_real.linecolor - - tg_data_id = [] - - if tg is not None: - set_id_list.append(self.add(tg, color=col)) - - set_id = self.add(fit, color=col) - self[set_id].setLine(style=LineStyle.Dashed) - self[set_id].setSymbol(symbol=SymbolStyle.No) - set_id_list.append(set_id) - - self.newData.emit(set_id_list, graph_id) + self.newData.emit(set_id_list, graph_id) @QtCore.pyqtSlot(int, dict) def smooth_data(self, npoints, param_kwargs): diff --git a/src/nmreval/fit/result.py b/src/nmreval/fit/result.py index eb03563..a2a83d1 100644 --- a/src/nmreval/fit/result.py +++ b/src/nmreval/fit/result.py @@ -244,7 +244,6 @@ class FitResult(Points): ret_val = '' for pval in self.parameter.values(): - print(pval) ret_val += convert(str(pval), old='tex', new='str') + '\n' if self.fun_kwargs: diff --git a/src/resources/_ui/tnmh_dialog.ui b/src/resources/_ui/tnmh_dialog.ui index d9201d6..7345efc 100644 --- a/src/resources/_ui/tnmh_dialog.ui +++ b/src/resources/_ui/tnmh_dialog.ui @@ -1,326 +1,430 @@ - Wizard - + DSCEvalDialog + 0 0 - 854 - 619 + 996 + 712 - Wizard + To boldly go where no man has gone before - - - Glass transition - - - - - - false - - - - 1 + + + + + + 0 + 0 + + + + QAbstractItemView::ExtendedSelection + + + + + + + + 0 + 0 + + + + QFrame::Box + + + 0 + + + + + + + + + Export Tg + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Export lines + + + true + + + + + + + Export + + + + + + + + + false + + + + 1 + + + + + + + + + 0 + 0 + + + + + + + + + + <html><head/><body><p><span style=" font-weight:600;">Glass transition</span></p></body></html> + + + + + + + + 0 + 0 + + + + Calculate Tg + + + + + + + + + + + + + Export tau: + + + + + + + + + + + 0 + 0 + + + + + + + + + + <html><head/><body><p><span style=" font-weight:600;">Hodge tau</span></p></body></html> + + + + + + + + 0 + 0 + + + + Make it so. + + + + + + + + + Export + + + + + + + false + + + + + + + New graph + + + true + + + + + + + + + Onset + + + true + + + + + + + Midpoint + + + true + + + + + + + End + + + true + + + + + + + Inflection + + + true + + + + + + + Fictive + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + + + + + false + + + + 1 + + + + + + + + + + New graph + + + true + + + + + + + Export fit + + + true + + + + + + + Export + + + + + + + Export dTf / dT + + + true + + + + + + + false + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + <html><head/><body><p><span style=" font-weight:600;">dTf/dT and TNMH </span></p></body></html> + + + + + + + Engage! + + + + + + + + + + + + + + + Qt::Horizontal - - - - - - - - - Export Tg - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Export lines - - - true - - - - - - - Export - - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - Calculate Tg - - - Qt::ToolButtonTextBesideIcon - - - Qt::RightArrow - - - - - - - - Hodge - - - - - - - 0 - 0 - - - - Calculate Hodge - - - Qt::ToolButtonTextBesideIcon - - - Qt::RightArrow - - - - - - - - - - - 0 - 0 - - - - - - - - - - End - - - true - - - - - - - New graph - - - true - - - - - - - Fictive - - - true - - - - - - - Inflection - - - true - - - - - - - false - - - - - - - Midpoint - - - true - - - - - - - Onset - - - true - - - - - - - Export - - - - - - - - - - - 0 - 0 - - - - TNMH - - - - - - - - - Fit TNMH model - - - - - - - false - - - - 1 + + + 40 + 20 + - - - - - - - - - New graph - - - true - - - - - - - Export fit - - - true - - - - - - - Export - - - - - - - Export dTf / dT - - - true - - - - - - - false - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - + + + + + + Back + + + Qt::ToolButtonTextBesideIcon + + + Qt::LeftArrow + + + + + + + Next + + + Qt::ToolButtonTextBesideIcon + + + Qt::RightArrow + + + + + + + Close + + + + + + @@ -328,7 +432,29 @@ QGraphicsView
pyqtgraph
+ + QListWidgetSelect + QListWidget +
..lib.listwidget
+
- + + + close_button + clicked() + DSCEvalDialog + close() + + + 931 + 671 + + + 490 + 346 + + + +