41 lines
3.4 KiB
Python
41 lines
3.4 KiB
Python
from PyQt6.QtWidgets import QWidget, QVBoxLayout, QFormLayout, QFileDialog, QCheckBox, QSpinBox
|
|
|
|
from cpdctrl_gui.utility.config import AppConfig
|
|
from .base import FileSelection, SettingsForm
|
|
|
|
class AppSettings(QWidget):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.setLayout(QVBoxLayout())
|
|
self.w_form = SettingsForm(AppConfig.MAIN_CFG)
|
|
self.layout().addWidget(self.w_form)
|
|
|
|
w_cache_dir = FileSelection(filemode=QFileDialog.FileMode.Directory)
|
|
self.w_form.add_form_row("dir_cache", "Cache Directory", "~/.cache/cpdctrl", w_cache_dir, "Directory to store temporary data")
|
|
self.w_form.add_form_row("led_device_auto_reconnect", "Autoconnect to last LED Controller", True, QCheckBox(), "Automatically connect to the last used LED Controller")
|
|
self.w_form.add_form_row("voltage_measurement_device_auto_reconnect", "Autoconnect to last Voltage Measurement Device", True, QCheckBox(), "Automatically connect to the last used Voltage Measurement Device")
|
|
w_plot_n = QSpinBox()
|
|
w_plot_n.setMinimum(1000)
|
|
w_plot_n.setMaximum(200000)
|
|
w_plot_n.setSingleStep(1000)
|
|
self.w_form.add_form_row("plot_max_data_points", "Max. Datapoints in the Plot", 20000, w_plot_n, "Maximum number of datapoints in the live plot.\nThis value is limited to ensure performance is not degraded in long measurements")
|
|
w_plot_dt = QSpinBox()
|
|
w_plot_dt.setMinimum(10)
|
|
w_plot_dt.setMaximum(200000)
|
|
w_plot_dt.setSingleStep(100)
|
|
self.w_form.add_form_row("plot_update_interval_ms", "Plot Update Interval (ms)", 200, w_plot_dt, "Number of milliseconds to wait before updating the live plot")
|
|
self.w_form.add_form_row("led_script_watch_file", "Watch Led Script File", False, QCheckBox(), "Watch the LED script file for changes and reload it automatically")
|
|
self.w_form.add_form_row("led_script_save_copy", "Copy Led Script to Cache Dir", True, QCheckBox(), "Save the final version of the led script in the cache directory")
|
|
self.w_form.add_form_row("metadata_auto_update", "Auto-Update Metadata", True, QCheckBox(), "Allow metadata updates while the program is running")
|
|
self.w_form.add_form_row("metadata_auto_add", "Auto-Add Metadata", True, QCheckBox(), "Automatically add measurement metadata to the data file.\nThis includes: device names, measurement mode, measurement interval, start and stop times, led script")
|
|
w_usb_switch_exe = FileSelection(filemode=QFileDialog.FileMode.ExistingFile)
|
|
self.w_form.add_form_row("power_switch_exe", "Power Switch Executable", "", w_usb_switch_exe, "Path to the USBSwitchCmd executable for the Cleware USB switch\nRequires a relaunch to take effect")
|
|
w_idle_dt = QSpinBox()
|
|
w_idle_dt.setMinimum(10)
|
|
w_idle_dt.setMaximum(200000)
|
|
w_idle_dt.setSingleStep(10)
|
|
self.w_form.add_form_row("idle_update_interval_s", "Device Connection Check Interval (s)", 30, w_plot_dt, "How often to check whether the devices are still connected.\nApplies only when not in a measurement.")
|
|
self.w_form.add_form_row("error_show_dialog", "Show Dialog on Error", True, QCheckBox(), "Whether to show a dialog window when uncaught errors occur\nLeave this on.")
|
|
self.w_form.add_form_row("error_stack_trace", "Stacktrace in errors", False, QCheckBox(), "Whether to show the call stack in unexpected error messages")
|
|
|