button to reset view limits of fit results; closes #156

This commit is contained in:
Dominik Demuth 2023-11-28 19:31:05 +01:00
parent 340d5d1038
commit 8a6c909c3e
3 changed files with 54 additions and 15 deletions

View File

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'src/resources/_ui/fitresult.ui' # Form implementation generated from reading ui file 'src/resources/_ui/fitresult.ui'
# #
# Created by: PyQt5 UI code generator 5.15.9 # Created by: PyQt5 UI code generator 5.15.10
# #
# WARNING: Any manual changes made to this file will be lost when pyuic5 is # WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing. # run again. Do not edit this file unless you know what you are doing.
@ -30,17 +30,22 @@ class Ui_Dialog(object):
self.gridLayout_3.setContentsMargins(3, 3, 3, 3) self.gridLayout_3.setContentsMargins(3, 3, 3, 3)
self.gridLayout_3.setSpacing(3) self.gridLayout_3.setSpacing(3)
self.gridLayout_3.setObjectName("gridLayout_3") self.gridLayout_3.setObjectName("gridLayout_3")
self.autoscale_box = QtWidgets.QToolButton(self.stackPage1)
self.autoscale_box.setObjectName("autoscale_box")
self.gridLayout_3.addWidget(self.autoscale_box, 2, 0, 1, 1)
self.logy_box = QtWidgets.QCheckBox(self.stackPage1) self.logy_box = QtWidgets.QCheckBox(self.stackPage1)
self.logy_box.setLayoutDirection(QtCore.Qt.RightToLeft) self.logy_box.setLayoutDirection(QtCore.Qt.LeftToRight)
self.logy_box.setObjectName("logy_box") self.logy_box.setObjectName("logy_box")
self.gridLayout_3.addWidget(self.logy_box, 2, 1, 1, 1) self.gridLayout_3.addWidget(self.logy_box, 2, 3, 1, 1)
self.logx_box = QtWidgets.QCheckBox(self.stackPage1)
self.logx_box.setLayoutDirection(QtCore.Qt.RightToLeft)
self.logx_box.setObjectName("logx_box")
self.gridLayout_3.addWidget(self.logx_box, 2, 0, 1, 1)
self.graphicsView = GraphicsLayoutWidget(self.stackPage1) self.graphicsView = GraphicsLayoutWidget(self.stackPage1)
self.graphicsView.setObjectName("graphicsView") self.graphicsView.setObjectName("graphicsView")
self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 2) self.gridLayout_3.addWidget(self.graphicsView, 0, 0, 1, 4)
self.logx_box = QtWidgets.QCheckBox(self.stackPage1)
self.logx_box.setLayoutDirection(QtCore.Qt.LeftToRight)
self.logx_box.setObjectName("logx_box")
self.gridLayout_3.addWidget(self.logx_box, 2, 2, 1, 1)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout_3.addItem(spacerItem, 2, 1, 1, 1)
self.stack.addTab(self.stackPage1, "") self.stack.addTab(self.stackPage1, "")
self.stackPage2 = QtWidgets.QWidget() self.stackPage2 = QtWidgets.QWidget()
self.stackPage2.setObjectName("stackPage2") self.stackPage2.setObjectName("stackPage2")
@ -203,6 +208,8 @@ class Ui_Dialog(object):
def retranslateUi(self, Dialog): def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Fit results")) Dialog.setWindowTitle(_translate("Dialog", "Fit results"))
self.autoscale_box.setToolTip(_translate("Dialog", "Auto-scale graph for all sets"))
self.autoscale_box.setText(_translate("Dialog", "Autoscale all sets"))
self.logy_box.setText(_translate("Dialog", "logarithmic y axis")) self.logy_box.setText(_translate("Dialog", "logarithmic y axis"))
self.logx_box.setText(_translate("Dialog", "logarithmic x axis")) self.logx_box.setText(_translate("Dialog", "logarithmic x axis"))
self.stack.setTabText(self.stack.indexOf(self.stackPage1), _translate("Dialog", "Plot")) self.stack.setTabText(self.stack.indexOf(self.stackPage1), _translate("Dialog", "Plot"))

View File

@ -153,6 +153,14 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
self.del_prev_checkBox.setChecked(self._opts[idx][1]) self.del_prev_checkBox.setChecked(self._opts[idx][1])
self.del_prev_checkBox.blockSignals(False) self.del_prev_checkBox.blockSignals(False)
@QtCore.pyqtSlot(name='on_autoscale_box_clicked')
def reset_fit_ranges(self):
for i in range(self.sets_comboBox.count()):
graph_id = self.sets_comboBox.itemData(i)
self.graph_opts.pop(graph_id)
self.fit_plot.enableAutoRange()
def set_plot(self, idx: str): def set_plot(self, idx: str):
if self.last_idx is not None: if self.last_idx is not None:
self.graph_opts[self.last_idx] = ( self.graph_opts[self.last_idx] = (
@ -203,6 +211,8 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
self.fit_plot.setLogMode(x=res.islog) self.fit_plot.setLogMode(x=res.islog)
self.resid_plot.setLogMode(x=res.islog) self.resid_plot.setLogMode(x=res.islog)
print(self.graph_opts)
if idx in self.graph_opts: if idx in self.graph_opts:
view_range, logx, logy = self.graph_opts[idx] view_range, logx, logy = self.graph_opts[idx]
self.fit_plot.setLogMode(x=logx, y=logy) self.fit_plot.setLogMode(x=logx, y=logy)
@ -215,7 +225,6 @@ class QFitResult(QtWidgets.QDialog, Ui_Dialog):
self.logy_box.blockSignals(False) self.logy_box.blockSignals(False)
else: else:
self.fit_plot.enableAutoRange() self.fit_plot.enableAutoRange()
self.fit_plot.disableAutoRange()
def set_correlation(self, idx: str): def set_correlation(self, idx: str):
while self.corr_tableWidget.rowCount(): while self.corr_tableWidget.rowCount():

View File

@ -45,28 +45,51 @@
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
<item row="2" column="1"> <item row="2" column="0">
<widget class="QToolButton" name="autoscale_box">
<property name="toolTip">
<string>Auto-scale graph for all sets</string>
</property>
<property name="text">
<string>Autoscale all sets</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QCheckBox" name="logy_box"> <widget class="QCheckBox" name="logy_box">
<property name="layoutDirection"> <property name="layoutDirection">
<enum>Qt::RightToLeft</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
<property name="text"> <property name="text">
<string>logarithmic y axis</string> <string>logarithmic y axis</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="0" column="0" colspan="4">
<widget class="GraphicsLayoutWidget" name="graphicsView"/>
</item>
<item row="2" column="2">
<widget class="QCheckBox" name="logx_box"> <widget class="QCheckBox" name="logx_box">
<property name="layoutDirection"> <property name="layoutDirection">
<enum>Qt::RightToLeft</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
<property name="text"> <property name="text">
<string>logarithmic x axis</string> <string>logarithmic x axis</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="2"> <item row="2" column="1">
<widget class="GraphicsLayoutWidget" name="graphicsView"/> <spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</widget> </widget>