From 91afe8224fde52b57a3baa43380a9dedb5991339 Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Sat, 8 Jul 2023 19:55:20 +0200 Subject: [PATCH] numerical values of data as tooltip; closes #90 --- src/gui_qt/data/datawidget/datawidget.py | 7 ++++--- src/gui_qt/main/mainwindow.py | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui_qt/data/datawidget/datawidget.py b/src/gui_qt/data/datawidget/datawidget.py index 0bd67b8..36cf700 100644 --- a/src/gui_qt/data/datawidget/datawidget.py +++ b/src/gui_qt/data/datawidget/datawidget.py @@ -68,8 +68,9 @@ class DataTree(QtWidgets.QTreeWidget): for row in range(self.invisibleRootItem().childCount()): graph = self.invisibleRootItem().child(row) if graph.data(0, QtCore.Qt.UserRole) == gid: - for (idd, name) in items: + for (idd, name, value) in items: item = QtWidgets.QTreeWidgetItem([name]) + item.setToolTip(0, f'Value: {value}') item.setData(0, QtCore.Qt.UserRole, idd) item.setCheckState(0, QtCore.Qt.Checked) item.setFlags(QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsEditable | @@ -566,9 +567,9 @@ class DataWidget(QtWidgets.QWidget, Ui_DataWidget): self.tree.add_graph(idd, name) self.tree.blockSignals(False) - def add_item(self, idd: str, name: str, gid: str): + def add_item(self, idd: str, name: str, value: str, gid: str): self.tree.blockSignals(True) - self.tree.add_item((idd, name), gid) + self.tree.add_item((idd, name, value), gid) self.tree.blockSignals(False) def add_item_list(self, loi: list, gid: str): diff --git a/src/gui_qt/main/mainwindow.py b/src/gui_qt/main/mainwindow.py index 5cefcac..66845f3 100644 --- a/src/gui_qt/main/mainwindow.py +++ b/src/gui_qt/main/mainwindow.py @@ -354,7 +354,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow): for idd in sets: new_item = self.management[idd] self.datawidget.blockSignals(True) - self.datawidget.add_item(new_item.id, new_item.name, graph) + self.datawidget.add_item(new_item.id, new_item.name, new_item.value, graph) self.datawidget.blockSignals(False) # if graph == self.fit_dialog.connected_figure: