diff options
| author | Christian Kolset <ckolset@colostate.edu> | 2026-07-29 13:03:24 -0600 |
|---|---|---|
| committer | Christian Kolset <ckolset@colostate.edu> | 2026-07-29 13:03:24 -0600 |
| commit | d9ca58e48cf92438087ac24ee261c2c4911316b1 (patch) | |
| tree | 7d2b01d5703842b955b3e1f0ccb15f1f35274a43 /core/profile.py | |
| parent | b407a079000f6a4b04ecf38eca17c57719e7a7ec (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 'core/profile.py')
| -rw-r--r-- | core/profile.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/core/profile.py b/core/profile.py index d3c7e3a..7ede859 100644 --- a/core/profile.py +++ b/core/profile.py @@ -302,8 +302,15 @@ class ProfileManager: print(f"[Profile] Unknown device type: {dev_type}") continue try: - kwargs = {k: v for k, v in dev_cfg.items() if k != "device_type"} + # "name" is a display label, not a constructor arg — every device + # factory builds its own default name internally, so apply it + # after construction instead of passing it through. + custom_name = dev_cfg.get("name") + kwargs = {k: v for k, v in dev_cfg.items() + if k not in ("device_type", "name")} dev = factory(**kwargs) + if custom_name: + dev.info.name = custom_name registry.add_instance(dev) dev.connect() if engine is not None: |
