forked from IPKM/nmreval
attempt to distinguish general and set-specifi parameter
This commit is contained in:
parent
8673e5acdb
commit
1e9a390ae2
@ -181,6 +181,7 @@ class QFitParameterWidget(QtWidgets.QWidget, Ui_FormFit):
|
|||||||
for i, value in enumerate(self.data_values[sid]):
|
for i, value in enumerate(self.data_values[sid]):
|
||||||
w = self.data_parameter[i]
|
w = self.data_parameter[i]
|
||||||
w.blockSignals(True)
|
w.blockSignals(True)
|
||||||
|
w.show_as_local_parameter(value is not None)
|
||||||
if value is None:
|
if value is None:
|
||||||
w.value = self.glob_values[i]
|
w.value = self.glob_values[i]
|
||||||
else:
|
else:
|
||||||
@ -293,6 +294,7 @@ class ParameterSingleWidget(QtWidgets.QWidget):
|
|||||||
|
|
||||||
self._name = name
|
self._name = name
|
||||||
self.label.setText(convert(name))
|
self.label.setText(convert(name))
|
||||||
|
self.label.setToolTip('IIf this is bold then this parameter is only for this data. otherwise the general parameter is used and displayed')
|
||||||
|
|
||||||
self.value_line.setValidator(QtGui.QDoubleValidator())
|
self.value_line.setValidator(QtGui.QDoubleValidator())
|
||||||
self.value_line.textChanged.connect(lambda: self.valueChanged.emit(self.value) if self.value is not None else 0)
|
self.value_line.textChanged.connect(lambda: self.valueChanged.emit(self.value) if self.value is not None else 0)
|
||||||
@ -309,10 +311,12 @@ class ParameterSingleWidget(QtWidgets.QWidget):
|
|||||||
layout.addSpacerItem(QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum))
|
layout.addSpacerItem(QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum))
|
||||||
|
|
||||||
self.value_line = QtWidgets.QLineEdit(self)
|
self.value_line = QtWidgets.QLineEdit(self)
|
||||||
|
self.value_line.textEdited.connect(lambda x: self.show_as_local_parameter(True))
|
||||||
layout.addWidget(self.value_line)
|
layout.addWidget(self.value_line)
|
||||||
|
|
||||||
self.reset_button = QtWidgets.QToolButton(self)
|
self.reset_button = QtWidgets.QToolButton(self)
|
||||||
self.reset_button.setText('Use global')
|
self.reset_button.setText('Use global')
|
||||||
|
self.reset_button.clicked.connect(lambda: self.show_as_local_parameter(False))
|
||||||
layout.addWidget(self.reset_button)
|
layout.addWidget(self.reset_button)
|
||||||
|
|
||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
@ -327,3 +331,9 @@ class ParameterSingleWidget(QtWidgets.QWidget):
|
|||||||
@value.setter
|
@value.setter
|
||||||
def value(self, val):
|
def value(self, val):
|
||||||
self.value_line.setText(f'{float(val):.5g}')
|
self.value_line.setText(f'{float(val):.5g}')
|
||||||
|
|
||||||
|
def show_as_local_parameter(self, is_local):
|
||||||
|
if is_local:
|
||||||
|
self.label.setStyleSheet('font-weight: bold;')
|
||||||
|
else:
|
||||||
|
self.label.setStyleSheet('')
|
||||||
|
Loading…
Reference in New Issue
Block a user