diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2026-09-20 23:45:18 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2026-09-20 23:45:18 -0600 |
| commit | a0473245f1f453bfc87ea1bc9bd479311e8a944b (patch) | |
| tree | 5c317d6b39c436fb58824e0553d7ba4603cc0829 /api_layers | |
| parent | 006366ef8099c8313ae596bf6267e9f98dfbeb5e (diff) | |
Persist dock layout to profiles; dedupe port names; Channels-tab Create button
- Fix duplicated device names ("FT231X USB UART - FT231X USB UART (...)")
— pyserial on Linux often reports the same udev model string twice for
cheap FTDI/CH340-style adapters. Collapse it at the list_ports() source
so every consumer (device auto-name, port picker) benefits.
- Save Control Panel / Namespace dock area, floating geometry, visibility,
size and order to .labui profiles via QMainWindow.saveState()/
restoreState(), round-tripped through the existing Profile.settings
passthrough (self._settings) — no profile schema change needed.
- Channels tab: replace the per-row Signal ⊕ button (and its pinned/
frozen-column overlay) with a single "Create Channel" button below the
Namespace panel. Select one or more Signal/Channel rows (multi-select
now supported) and click it — selected rows become the new Channel's
sources, or an empty Channel is created if nothing's selected. Fixes a
bug in the process: the multi/zero-source path defaulted to
kind="expression" with no expression text, which fails to compile and
silently dropped the channel; use kind="none" instead, which the user
then edits in the Channels pane.
NamespacePanel itself (ui/namespace_panel.py) goes back to a plain
read-only reference widget — the create-channel button and its logic
live entirely in ConfigWindow (config_window.py), so the shared
dockable Namespace panel on the main window is unaffected.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'api_layers')
| -rw-r--r-- | api_layers/arduino_layer.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/api_layers/arduino_layer.py b/api_layers/arduino_layer.py index 07520d6..cd7cb92 100644 --- a/api_layers/arduino_layer.py +++ b/api_layers/arduino_layer.py @@ -81,6 +81,18 @@ except ImportError: _SERIAL_AVAILABLE = False +def _dedupe_description(desc: str) -> str: + """pyserial on Linux often reports a USB-serial adapter's description as + "X - X" (same udev model string used for both halves when there's no + separate manufacturer/interface field — common on cheap FTDI/CH340 + clones), which then reads as a literal duplicate everywhere this + description gets shown (device name, port picker). Collapse it.""" + parts = desc.split(" - ") + if len(parts) == 2 and parts[0].strip() == parts[1].strip(): + return parts[0].strip() + return desc + + class ArduinoLayer: DEFAULT_ANALOG_PINS = ["A0", "A1", "A2", "A3", "A4", "A5"] @@ -552,7 +564,7 @@ class ArduinoLayer: return [] try: return [ - (p.device, p.description or "") + (p.device, _dedupe_description(p.description or "")) for p in serial.tools.list_ports.comports() ] except Exception as e: |
