interim save
This commit is contained in:
parent
bc946e1027
commit
8de4a0cbd3
@ -15,14 +15,15 @@ from nmreval.data import DSC, Points
|
||||
|
||||
|
||||
class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
newTg = QtCore.pyqtSignal(dict)
|
||||
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.setObjectName('listWidget')
|
||||
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))
|
||||
|
||||
@ -241,9 +242,9 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
|
||||
ret_dic[key] = (tg_pts, line)
|
||||
|
||||
self.newTg.emit(ret_dic)
|
||||
self.newData.emit(ret_dic, 'tg')
|
||||
|
||||
@QtCore.pyqtSlot(QtWidgets.QListWidgetItem, name='on_listWidget_itemChanged')
|
||||
@QtCore.pyqtSlot(QtWidgets.QListWidgetItem)
|
||||
def change_visibility(self, item: QtWidgets.QListWidgetItem):
|
||||
is_checked = bool(item.checkState())
|
||||
plot = self._plots[item.data(QtCore.Qt.UserRole)]
|
||||
@ -303,6 +304,8 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
m = []
|
||||
for idx in range(self.listWidget.count()):
|
||||
item = self.listWidget.item(idx)
|
||||
if item.checkState() == QtCore.Qt.Unchecked:
|
||||
continue
|
||||
|
||||
key = item.data(QtCore.Qt.UserRole)
|
||||
data, _ = self._dsc[key]
|
||||
@ -324,6 +327,25 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
|
||||
self._hodge[tg_type] = (plot, data, fitplots, fit)
|
||||
|
||||
@QtCore.pyqtSlot(name='on_pushButton_4_clicked')
|
||||
def export_hodge(self):
|
||||
ret_dic2 = {}
|
||||
|
||||
for cb in (self.checkBox, self.checkBox_4, self.checkBox_6, self.checkBox_5, self.checkBox_7):
|
||||
if cb.isChecked():
|
||||
item = cb.text().lower()
|
||||
v = self._hodge.get(item)
|
||||
ret_dic2[item] = v[1]
|
||||
|
||||
if self.new_graph_tau_check.isChecked():
|
||||
ret_dic2['graph'] = self.new_graph_tau_combo.currentData()
|
||||
else:
|
||||
ret_dic2['graph'] = ''
|
||||
|
||||
print(ret_dic2)
|
||||
|
||||
self.newData.emit(ret_dic2, 'hodge')
|
||||
|
||||
def close(self) -> bool:
|
||||
self.clear()
|
||||
return super().close()
|
||||
@ -350,13 +372,5 @@ class TgCalculator(QtWidgets.QWizard, Ui_Wizard):
|
||||
|
||||
ret_dic[key] = (tg_pts, line)
|
||||
|
||||
ret_dic2 = []
|
||||
|
||||
for i in range(self.hodge_selection.count()):
|
||||
if self.hodge_selection.isChecked(i):
|
||||
item = self.hodge_selection.itemText(i).lower()
|
||||
v = self._hodge.get(item)
|
||||
ret_dic2.append(v[1])
|
||||
|
||||
self.newTg.emit(ret_dic, ret_dic2, graph_id)
|
||||
self.close()
|
||||
|
@ -1143,7 +1143,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
|
||||
def show_tg_dialog(self):
|
||||
if self._tg_dialog is None:
|
||||
self._tg_dialog = TgCalculator(self.management, parent=self)
|
||||
self._tg_dialog.newTg.connect(self.management.addTg)
|
||||
self._tg_dialog.newData.connect(self.management.addTg)
|
||||
else:
|
||||
self._tg_dialog()
|
||||
self._tg_dialog.show()
|
||||
|
@ -773,8 +773,9 @@ class UpperManagement(QtCore.QObject):
|
||||
|
||||
self.newData.emit(new_data, self.current_graph)
|
||||
|
||||
@QtCore.pyqtSlot(dict)
|
||||
def addTg(self, dic1: dict):
|
||||
@QtCore.pyqtSlot(dict, str)
|
||||
def addTg(self, dic1: dict, dtype: str):
|
||||
if dtype == 'tg':
|
||||
for k, (tg, lines) in dic1.items():
|
||||
p: ExperimentContainer = self[k]
|
||||
col = p.plot_real.linecolor
|
||||
@ -792,6 +793,13 @@ class UpperManagement(QtCore.QObject):
|
||||
|
||||
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)
|
||||
|
||||
@QtCore.pyqtSlot(int, dict)
|
||||
def smooth_data(self, npoints, param_kwargs):
|
||||
_active = self.graphs[self.current_graph].active
|
||||
|
Loading…
Reference in New Issue
Block a user