1
0
Fork 0
mirror of https://github.com/Athemis/PyDSF.git synced 2025-04-04 22:36:02 +00:00

Move tabbed plots in a GroupBox

This commit is contained in:
Alexander Minges 2015-07-08 14:58:38 +02:00
parent 6250864ead
commit 6a2c7f2762
3 changed files with 79 additions and 18 deletions

View file

@ -31,6 +31,7 @@ class Ui_MainWindow(object):
sizePolicy.setHeightForWidth(self.groupBox_experiment.sizePolicy().hasHeightForWidth())
self.groupBox_experiment.setSizePolicy(sizePolicy)
self.groupBox_experiment.setMinimumSize(QtCore.QSize(100, 300))
self.groupBox_experiment.setSizeIncrement(QtCore.QSize(0, 0))
self.groupBox_experiment.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.groupBox_experiment.setFlat(False)
self.groupBox_experiment.setCheckable(False)
@ -194,19 +195,32 @@ class Ui_MainWindow(object):
self.buttonBox_process.setStandardButtons(QtWidgets.QDialogButtonBox.NoButton)
self.buttonBox_process.setObjectName("buttonBox_process")
self.formLayout_3.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.buttonBox_process)
self.tabWidget = QtWidgets.QTabWidget(self.splitter)
self.tabWidget.setEnabled(True)
self.groupBox_results = QtWidgets.QGroupBox(self.splitter)
self.groupBox_results.setEnabled(True)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(6)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.groupBox_results.sizePolicy().hasHeightForWidth())
self.groupBox_results.setSizePolicy(sizePolicy)
self.groupBox_results.setSizeIncrement(QtCore.QSize(0, 0))
self.groupBox_results.setObjectName("groupBox_results")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.groupBox_results)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.tabWidget = QtWidgets.QTabWidget(self.groupBox_results)
self.tabWidget.setEnabled(True)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
self.tabWidget.setSizePolicy(sizePolicy)
self.tabWidget.setMinimumSize(QtCore.QSize(300, 300))
self.tabWidget.setSizeIncrement(QtCore.QSize(0, 0))
self.tabWidget.setObjectName("tabWidget")
self.horizontalLayout_2.addWidget(self.tabWidget)
self.horizontalLayout.addWidget(self.splitter)
MainWindow.setCentralWidget(self.centralWidget)
self.menuBar = QtWidgets.QMenuBar(MainWindow)
self.menuBar.setGeometry(QtCore.QRect(0, 0, 1066, 29))
self.menuBar.setGeometry(QtCore.QRect(0, 0, 1066, 28))
self.menuBar.setLocale(QtCore.QLocale(QtCore.QLocale.English, QtCore.QLocale.UnitedStates))
self.menuBar.setObjectName("menuBar")
self.menuFile = QtWidgets.QMenu(self.menuBar)
@ -279,6 +293,7 @@ class Ui_MainWindow(object):
self.doubleSpinBox_cbar_start.setSuffix(_translate("MainWindow", " °C"))
self.label_cbar_end.setText(_translate("MainWindow", "En&d"))
self.doubleSpinBox_cbar_end.setSuffix(_translate("MainWindow", " °C"))
self.groupBox_results.setTitle(_translate("MainWindow", "Plots"))
self.menuFile.setTitle(_translate("MainWindow", "Fi&le"))
self.menuHelp.setTitle(_translate("MainWindow", "Hel&p"))
self.actionQuit.setText(_translate("MainWindow", "&Quit"))

View file

@ -142,6 +142,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
elif button == self.buttonBox_open_reset.button(
QDialogButtonBox.Reset):
self.listWidget_data.clear()
self.remove_plate_tabs()
@pyqtSlot("QString")
def on_comboBox_instrument_currentIndexChanged(self, p0):
@ -158,28 +159,37 @@ class MainWindow(QMainWindow, Ui_MainWindow):
tab.setObjectName(name)
return tab
def remove_plate_tabs(self):
for i in range(self.tabWidget.count()):
try:
widget = self.tabWidget.widget(i)
widget.deleteLater()
except IndexError:
pass
self.tabWidget.clear()
def generate_plate_tabs(self, plate):
plotter = PlotResults()
if id != 'average':
tab = self.generate_plot_tab("tab_heatmap_{}".format(id))
self.tabWidget.addTab(tab, _translate(
"MainWindow", "Heatmap #{}".format(plate.id)))
title = _translate("MainWindow", "Heatmap #")
self.tabWidget.addTab(tab, title + str(plate.id))
plotter.plot_tm_heatmap_single(plate, tab)
tab = self.generate_plot_tab("tab_raw_{}".format(id))
self.tabWidget.addTab(tab, _translate(
"MainWindow", "Raw Data #{}".format(plate.id)))
title = _translate("MainWindow", "Raw Data #")
self.tabWidget.addTab(tab, title + str(plate.id))
plotter.plot_raw(plate, tab)
tab = self.generate_plot_tab("tab_derivative_{}".format(id))
self.tabWidget.addTab(tab, _translate(
"MainWindow", "Derivatives #{}".format(plate.id)))
title = _translate("MainWindow", "Derivatives #")
self.tabWidget.addTab(tab, title + str(plate.id))
plotter.plot_derivative(plate, tab)
else:
tab = self.generate_plot_tab("tab_heatmap_{}".format(id))
self.tabWidget.addTab(tab, _translate(
"MainWindow", "Heatmap ({})".format(plate.id)))
title = _translate("MainWindow", "Heatmap ")
self.tabWidget.addTab(tab, title + str(plate.id))
plotter.plot_tm_heatmap_single(plate, tab)
@pyqtSlot()

View file

@ -48,6 +48,12 @@
<height>300</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Experimental Setup</string>
</property>
@ -465,7 +471,7 @@
</item>
</layout>
</widget>
<widget class="QTabWidget" name="tabWidget">
<widget class="QGroupBox" name="groupBox_results">
<property name="enabled">
<bool>true</bool>
</property>
@ -475,15 +481,45 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<property name="sizeIncrement">
<size>
<width>300</width>
<height>300</height>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="currentIndex">
<number>-1</number>
<property name="title">
<string>Plots</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
@ -495,7 +531,7 @@
<x>0</x>
<y>0</y>
<width>1066</width>
<height>29</height>
<height>28</height>
</rect>
</property>
<property name="locale">