docs(da07): refresh channels docstring and pending caveat; assert toggle precondition

This commit is contained in:
2026-06-11 12:52:12 -04:00
parent 5f51b55c93
commit b41406a0dd
2 changed files with 6 additions and 3 deletions

View File

@@ -1,9 +1,9 @@
"""Channels tab: the per-device channel grid (Grid2) with a device selector.
Shows one device's channels at a time. Live 'Input' (raw) and 'Scaled' (averaged)
values arrive from G/F frames; the Status cell is tinted on a non-OK channel and a
Refresh column counts seconds since the last input, tinted by staleness — mirroring
the DA-12 Sensors tab.
values arrive from G/F frames; the Status cell renders a §1.2 status tag (alarm-class
rows also get the full-row alarm treatment) and a Refresh column counts seconds since
the last input, tinted by staleness — mirroring the DA-12 Sensors tab.
"""
from __future__ import annotations
@@ -281,6 +281,8 @@ class ChannelsTab(TableTab):
return
getattr(self._ctrl, setter)(self._device, self._channels[row].channel, value)
self.delegate.mark_pending(row, col)
# row index may go stale if the grid reorders or the device switches before
# resolve; cosmetic only
self._pending_writes.add((row, col))
def on_check(self, row: int, col: int, checked: bool) -> None:

View File

@@ -53,6 +53,7 @@ def test_active_column_is_a_toggle_and_writes(qtbot, monkeypatch):
tab, ctrl = _tab(qtbot, channels=2)
item = tab.table.item(0, 1)
assert item.flags() & Qt.ItemFlag.ItemIsUserCheckable
assert item.checkState() == Qt.CheckState.Checked # sim seeds channels active
sent = []
monkeypatch.setattr(
ctrl, "set_channel_active", lambda dev, ch, on: sent.append((dev, ch, on))