diff options
| author | Christian Kolset <christian.kolset@gmail.com> | 2026-08-02 01:34:43 -0600 |
|---|---|---|
| committer | Christian Kolset <christian.kolset@gmail.com> | 2026-08-02 01:34:43 -0600 |
| commit | a3aa1df99df8f413cac2ba6020b7cd0dec6d2390 (patch) | |
| tree | a4c5feca6b0db326d9e54f417abc132c1270a7a3 /ui/windows/channels_window.py | |
| parent | f5066a8ca2fb50aa3dddf2c8847e52574cdde6ad (diff) | |
| parent | f1aaffbc3eb1e2c154315c556d2555803eea7997 (diff) | |
Merge origin/main: reconcile ConfigWindow consolidation with Debug window + protocol updates
origin/main (23 commits) added a Debug window/log system on top of the old
separate Devices/Channels/Plot windows, plus protocol fixes (cml, mark10,
modbus_rtu, scpi) and device/profile changes. Local main (3 commits)
replaced the separate windows with a unified ConfigWindow + dock panel.
Kept local's ConfigWindow/dock architecture and ported the Debug window
onto it: new toolbar button + _open_debug(), gated by developer_mode same
as origin's version. Deduped the two independent "developer mode" toggles
that had collided in SettingsWindow (origin's General-tab checkbox gating
Debug window + device sim-mode visibility, local's Advanced-tab checkbox
setting verbose logging) into one General-tab checkbox that does both.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Diffstat (limited to 'ui/windows/channels_window.py')
| -rw-r--r-- | ui/windows/channels_window.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ui/windows/channels_window.py b/ui/windows/channels_window.py index 381800a..38d477b 100644 --- a/ui/windows/channels_window.py +++ b/ui/windows/channels_window.py @@ -74,7 +74,7 @@ def _channel_combo(registry: DeviceRegistry, for ch in dev.info.channels: if not ch.enabled: continue - label = f"{dev.info.device_id} / {ch.channel_id} ({ch.name})" + label = f"{ch.name} ({dev.info.device_id}/{ch.channel_id})" if show_unit and ch.unit: label += f" [{ch.unit}]" cb.addItem(label, userData=(dev.info.device_id, ch.channel_id)) @@ -115,7 +115,7 @@ class ChannelPickerDialog(QDialog): if (dev.info.device_id, ch.channel_id) in already_shown: continue any_available = True - label = f"{dev.info.device_id} / {ch.channel_id} ({ch.name})" + label = f"{ch.name} ({dev.info.device_id}/{ch.channel_id})" if ch.unit: label += f" [{ch.unit}]" chk = QCheckBox(label) @@ -236,7 +236,7 @@ class ChannelPipelineBlock(QFrame): # Header hdr = QWidget(); hdr.setObjectName("plotBlockHeader"); hdr.setFixedHeight(32) hl = QHBoxLayout(hdr); hl.setContentsMargins(8, 0, 6, 0) - title = f"{self.dev_id} / {self.ch_id} ({ch_name})" + title = f"{ch_name} ({self.dev_id}/{self.ch_id})" if unit: title += f" [{unit}]" self._title_lbl = QLabel(title); self._title_lbl.setObjectName("traceSource") @@ -307,7 +307,7 @@ class ChannelPipelineBlock(QFrame): self._body.setVisible(False) def _refresh_title(self): - title = f"{self.dev_id} / {self.ch_id} ({self._ch_name})" + title = f"{self._ch_name} ({self.dev_id}/{self.ch_id})" if self._unit: title += f" [{self._unit}]" self._title_lbl.setText(title) @@ -444,7 +444,12 @@ class PipelineTab(QWidget): virt_bar = QWidget(); virt_bar.setObjectName("cfgGlobalBar") vb_lay = QHBoxLayout(virt_bar); vb_lay.setContentsMargins(10, 7, 10, 7); vb_lay.setSpacing(6) vb_lbl = QLabel("Channels"); vb_lbl.setObjectName("devWindowTitle") - vb_lay.addWidget(vb_lbl, 1) + vb_lay.addWidget(vb_lbl) + self._src_cb = _channel_combo(self.registry, self.processor, include_derived=True) + self._src_cb.setObjectName("channelPickerCb") + self._src_cb.insertItem(0, "Source: none (empty channel)", userData=None) + self._src_cb.setCurrentIndex(0) + vb_lay.addWidget(self._src_cb, 1) add_virt = QPushButton("+ Add Channel"); add_virt.setObjectName("addTraceBtn") add_virt.clicked.connect(self._add_virtual) vb_lay.addWidget(add_virt) @@ -579,6 +584,11 @@ class PipelineTab(QWidget): kind="expression", color=color) blk = self._make_derived_block(dc) self._virt_inner.insertWidget(self._virt_inner.count() - 1, blk) + # Pre-seed the source picked in the bar above, if any — otherwise the + # channel is created empty and sources can be added manually. + src = self._src_cb.currentData() + if src: + blk._add_src(src) def _make_derived_block(self, dc: DerivedChannel) -> DerivedBlock: blk = DerivedBlock(dc, self.registry, self.processor) |
