-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlotWidget.py
43 lines (30 loc) · 1.44 KB
/
PlotWidget.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from PySide6.QtWidgets import QTabWidget, QWidget, QVBoxLayout
from SubTabs import SubTabs
class PlotWidget(QTabWidget):
def __init__(self, datacollector):
super().__init__()
self.setWindowTitle("Plot Widget")
self.setMinimumSize(600, 600)
self.datacollector = datacollector
def widget(self, index) -> SubTabs:
return super().widget(index)
def redrawTab(self, tabitem):
# check if the tab is already existing.
# if it is not existing: create it. otherwise: recalculate the tab
fitpage_index = tabitem.get_fitpage_index()
plot_index = self.datacollector.get_data_fp(fitpage_index).get_plotpage_index()
if plot_index == -1:
self.datacollector.set_plot_index(fitpage_index, self.count())
self.addTab(SubTabs(self.datacollector, tabitem), "Plot for FitPage " + str(fitpage_index))
else:
self.removeTab(plot_index)
self.insertTab(plot_index, SubTabs(self.datacollector, tabitem),
"Plot for FitPage " + str(fitpage_index))
def get_subtabs(self, fitpage_index):
for i in range(self.count()):
if fitpage_index == self.widget(i).fitpage_index:
return self.widget(i)
def get_figures(self, fitpage_index):
for i in range(self.count()):
if fitpage_index == self.widget(i).fitpage_index:
return self.widget(i).figures