Add sane defaults for spin boxes, add add_metadata setting

This commit is contained in:
CPD 2025-03-10 11:28:34 +01:00
parent adffbd6dbd
commit 89850c08c8

View File

@ -101,12 +101,21 @@ class MeasurementSettings(QWidget):
# key-value stuff in a form # key-value stuff in a form
self.l_vbox.addLayout(self.l_form) self.l_vbox.addLayout(self.l_form)
self.ws_form = {} self.ws_form = {}
self._add_form_field("interval", "Interval [s]", 1.0, QDoubleSpinBox(self), "Amount of seconds to wait between voltage measurements and LED device updates") w_box_interval = QDoubleSpinBox(self)
w_box_interval.setDecimals(2)
w_box_interval.setMinimum(0.01)
w_box_interval.setSingleStep(0.1)
self._add_form_field("interval", "Interval [s]", 1.0, w_box_interval, "Amount of seconds to wait between voltage measurements and LED device updates")
w_box_max_measurements = QSpinBox(self)
self._add_form_field("max_measurements", "Max Measurements", 0, QSpinBox(self), "Number of measurements to take. Set to 0 for infinite measurements") self._add_form_field("max_measurements", "Max Measurements", 0, QSpinBox(self), "Number of measurements to take. Set to 0 for infinite measurements")
self._add_form_field("stop_on_script_end", "Stop on Script End", False, QCheckBox(self), "Stop measurement when LED script ends") self._add_form_field("stop_on_script_end", "Stop on Script End", False, QCheckBox(self), "Stop measurement when LED script ends")
self._add_form_field("use_buffer", "Use Buffer", False, QCheckBox(self), "If available, use device buffer for more accurate measurement timings.\nLeads to a lower accuracy of LED update timings, up to 1*interval") self._add_form_field("use_buffer", "Use Buffer", False, QCheckBox(self), "If available, use the voltage device buffer for more accurate measurement timings.\nLeads to a lower accuracy of LED update timings, up to 1*interval")
self._add_form_field("flush_after", "Flush after", 0, QSpinBox(self), "Number of measurements to take before writing the data to an intermediate file") w_box_flush_after = QSpinBox(self)
w_box_flush_after.setMaximum(2147483647) # max int32
w_box_flush_after.setSingleStep(500)
self._add_form_field("flush_after", "Flush after", 0, w_box_flush_after, "Number of measurements to take before writing the data to an intermediate file")
self.l_vbox.addStretch(1) self.l_vbox.addStretch(1)
self._add_form_field("auto_add_metadata", "Auto-add Metadata", True, QCheckBox(self), "Automatically add measurement metadata to the data file.\nThis includes: device names, measurement mode, measurement interval, start and stop times, led script")
def _add_form_field(self, key: str, label: str, default_value, widget: QWidget, tooltip: str = None): def _add_form_field(self, key: str, label: str, default_value, widget: QWidget, tooltip: str = None):
if tooltip: widget.setToolTip(tooltip) if tooltip: widget.setToolTip(tooltip)