From af1479328643aaf294bdd22777085cb8ac4fd0ad Mon Sep 17 00:00:00 2001 From: Dominik Demuth Date: Fri, 26 May 2023 17:28:06 +0200 Subject: [PATCH] more ui --- src/gui_qt/dsc/glass_dialog.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/gui_qt/dsc/glass_dialog.py b/src/gui_qt/dsc/glass_dialog.py index 14bdb9a..34e65fd 100644 --- a/src/gui_qt/dsc/glass_dialog.py +++ b/src/gui_qt/dsc/glass_dialog.py @@ -1,5 +1,6 @@ -from gui_qt.Qt import QtWidgets +from gui_qt.Qt import QtWidgets, QtCore from gui_qt._py.tnmh_dialog import Ui_Dialog +from gui_qt.lib.pg_objects import PlotItem class TgCalculator(QtWidgets.QDialog, Ui_Dialog): @@ -9,7 +10,27 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog): self.setupUi(self) self._management = management - print('hello there') + self._plots = {} + + def __call__(self): + self.clear() + self.add_sets() + # s.valuesChanged.connect(self.management.shift_scale) + + def clear(self): + self.listWidget.clear() + for k, v in self._plots.items(): + self.graphicsView.removeItem(v) + + def add_sets(self): + for key, name in self._management.active_sets: + data = self._management.data[key] + + item = QtWidgets.QListWidgetItem(name) + item.setData(QtCore.Qt.UserRole, key) + plot = PlotItem(x=data.x, y=data.y) + self.graphicsView.addItem(plot) + self._plots[key] = plot if __name__ == '__main__':