This commit is contained in:
Dominik Demuth 2023-05-26 18:22:13 +02:00
parent af14793286
commit 30750cc4ed
2 changed files with 23 additions and 11 deletions

View File

@ -1,6 +1,8 @@
from gui_qt.Qt import QtWidgets, QtCore from ..Qt import QtWidgets, QtCore
from gui_qt._py.tnmh_dialog import Ui_Dialog from .._py.tnmh_dialog import Ui_Dialog
from gui_qt.lib.pg_objects import PlotItem from ..lib.pg_objects import PlotItem, RegionItem
from nmreval.data import DSC
class TgCalculator(QtWidgets.QDialog, Ui_Dialog): class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
@ -12,6 +14,12 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
self._plots = {} self._plots = {}
self.limits = RegionItem(), RegionItem()
for lim in self.limits:
self.graphicsView.addItem(lim)
self.add_sets()
def __call__(self): def __call__(self):
self.clear() self.clear()
self.add_sets() self.add_sets()
@ -25,17 +33,11 @@ class TgCalculator(QtWidgets.QDialog, Ui_Dialog):
def add_sets(self): def add_sets(self):
for key, name in self._management.active_sets: for key, name in self._management.active_sets:
data = self._management.data[key] data = self._management.data[key]
if not isinstance(data.data, DSC):
continue
item = QtWidgets.QListWidgetItem(name) item = QtWidgets.QListWidgetItem(name)
item.setData(QtCore.Qt.UserRole, key) item.setData(QtCore.Qt.UserRole, key)
plot = PlotItem(x=data.x, y=data.y) plot = PlotItem(x=data.x, y=data.y)
self.graphicsView.addItem(plot) self.graphicsView.addItem(plot)
self._plots[key] = plot self._plots[key] = plot
if __name__ == '__main__':
app = QtWidgets.QApplication([])
w = TgCalculator(None)
w.show()
app.exec()

View File

@ -94,6 +94,16 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0" colspan="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QListWidget" name="listWidget_2"/>
</item>
</layout> </layout>
</item> </item>
<item row="1" column="3"> <item row="1" column="3">