summaryrefslogtreecommitdiff
path: root/ui/config_dialog.py
diff options
context:
space:
mode:
authorChristian Kolset <ckolset@colostate.edu>2026-07-29 13:03:24 -0600
committerChristian Kolset <ckolset@colostate.edu>2026-07-29 13:03:24 -0600
commitd9ca58e48cf92438087ac24ee261c2c4911316b1 (patch)
tree7d2b01d5703842b955b3e1f0ccb15f1f35274a43 /ui/config_dialog.py
parentb407a079000f6a4b04ecf38eca17c57719e7a7ec (diff)
Add editable device display name, persist it across profile save/load
DeviceInfo.name existed but was hardcoded per device type and never operator-editable. Adds a Display Name field to Add Device and makes the Info-tab Name field in the device config dialog editable, and threads the name through get_save_config()/ProfileManager.apply() so a custom name survives a .labdaq save/reload instead of reverting to the type default. Name is applied post-construction rather than as a constructor kwarg, since no device factory declares a "name" param. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'ui/config_dialog.py')
-rw-r--r--ui/config_dialog.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ui/config_dialog.py b/ui/config_dialog.py
index d9bc9df..5a95821 100644
--- a/ui/config_dialog.py
+++ b/ui/config_dialog.py
@@ -59,7 +59,14 @@ class DeviceConfigDialog(QDialog):
e = QLineEdit(str(v)); e.setReadOnly(True); return e
form.addRow("Device ID:", _ro(info.device_id))
- form.addRow("Name:", _ro(info.name))
+
+ def _on_name_edited():
+ info.name = name_edit.text().strip() or info.name
+ self.setWindowTitle(f"Configure — {info.name} [{info.device_id}]")
+
+ name_edit = QLineEdit(info.name)
+ name_edit.editingFinished.connect(_on_name_edited)
+ form.addRow("Name:", name_edit)
form.addRow("Type:", _ro(info.device_type))
form.addRow("Description:", _ro(info.description))
form.addRow("Manufacturer:", _ro(info.manufacturer))