summaryrefslogtreecommitdiff
path: root/ui/control_editor.py
diff options
context:
space:
mode:
authorChristian Kolset <christian.kolset@gmail.com>2026-04-22 12:21:28 -0600
committerChristian Kolset <christian.kolset@gmail.com>2026-04-22 12:21:28 -0600
commit91101126e9d044adb8afa635cca1ab5d5a4c51a6 (patch)
tree5e8a5de10751e82e76092e37760cc984346f7eb7 /ui/control_editor.py
parent38ba9706e43c24a9d882b9d0d627812e01a30744 (diff)
Fixed saving profile to include devices and their configuration
Diffstat (limited to 'ui/control_editor.py')
-rw-r--r--ui/control_editor.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/control_editor.py b/ui/control_editor.py
index 4d18aef..901d6f8 100644
--- a/ui/control_editor.py
+++ b/ui/control_editor.py
@@ -51,6 +51,7 @@ class ControlSpec:
icon: str = "⏻"
device_id: str = ""
channel_id: str = ""
+ active_low: bool = False
# Type-specific params
unit: str = ""
min_val: float = 0.0
@@ -206,6 +207,9 @@ class ControlEditorDialog(QDialog):
self._ch_cb.setInsertPolicy(QComboBox.InsertPolicy.NoInsert)
hw_form.addRow("Channel / Pin:", self._ch_cb)
+ self._active_low_chk = QCheckBox("Active-low output (ON sends LOW)")
+ hw_form.addRow("Polarity:", self._active_low_chk)
+
self._ch_hint = QLabel("")
self._ch_hint.setObjectName("traceSource")
self._ch_hint.setWordWrap(True)
@@ -255,6 +259,7 @@ class ControlEditorDialog(QDialog):
# Channel (populated after device selection)
self._on_dev_changed()
self._ch_cb.setCurrentText(self.spec.channel_id)
+ self._active_low_chk.setChecked(bool(self.spec.active_low))
# Params
for name, panel in self._param_panels.items():
@@ -263,6 +268,7 @@ class ControlEditorDialog(QDialog):
def _on_type_changed(self, type_name: str):
idx = list(_PARAM_PANELS.keys()).index(type_name)
self._stack.setCurrentIndex(idx)
+ self._active_low_chk.setEnabled(type_name == "On/Off Switch")
# Auto-set title if still default
if not self._title_edit.text() or \
self._title_edit.text() in CONTROL_TYPES:
@@ -309,6 +315,7 @@ class ControlEditorDialog(QDialog):
icon=CONTROL_ICONS.get(ctype, "⚙"),
device_id=self._dev_cb.currentData() or "",
channel_id=channel_id,
+ active_low=self._active_low_chk.isChecked(),
)
# Save type-specific params
panel = self._param_panels.get(ctype)