feat: highlight whole mounted row in sample list
CI / lint (pull_request) Successful in 42s
CI / test (3.12) (pull_request) Successful in 1m4s
CI / test (3.13) (pull_request) Successful in 1m3s
CI / test (3.14) (pull_request) Successful in 1m7s
CI / test-with-beamline-plugins (pxi_bec) (pull_request) Successful in 1m7s
CI / test-with-beamline-plugins (pxii_bec) (pull_request) Successful in 1m16s
CI / test-with-beamline-plugins (pxiii_bec) (pull_request) Successful in 1m25s
CI / test-with-coverage (pull_request) Successful in 1m33s
CI / coverage-analysis (pull_request) Successful in 4s
CI / lint (push) Successful in 36s
Docs build and publish / docker (push) Successful in 5s
CI / test (3.12) (push) Canceled after 1m6s
CI / test (3.13) (push) Canceled after 57s
CI / test (3.14) (push) Canceled after 55s
CI / test-with-beamline-plugins (pxi_bec) (push) Canceled after 52s
CI / test-with-beamline-plugins (pxii_bec) (push) Canceled after 36s
CI / test-with-beamline-plugins (pxiii_bec) (push) Canceled after 32s
CI / test-with-coverage (push) Canceled after 31s
CI / coverage-analysis (push) Canceled after 0s
Build and Publish / release (push) Successful in 15s

The mounted sample used to tint only the frozen "#" cell. Paint the full
row in the same blue so it is findable at a glance, and keep the theme's
own text color on it (the mid-tone blue reads fine without the dark ink
that the pastel status tints need). Repaint the whole row span on
mount/unmount, not just column 0.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit was merged in pull request #209.
This commit is contained in:
2026-09-09 16:54:43 +02:00
committed by duan_j
co-authored by Claude Fable 5.1
parent a2c5ed3d5c
commit 22228c0868
2 changed files with 31 additions and 7 deletions
+16 -7
View File
@@ -139,17 +139,25 @@ class UserSampleSpreadsheet(QAbstractTableModel):
elif role == Qt.ItemDataRole.BackgroundRole:
# Status lives in the "#" column, as a full cell fill under the
# row number — rows themselves alternate grey/white (view-level)
# and selection stays the pale blue tint.
# and selection stays the pale blue tint. Exception: the mounted
# sample paints the WHOLE row blue so it is findable at a glance.
sample = self._sorted_samples[index.row()]
if sample.db_id == self.current_sample:
return QBrush(qcolor(SAMPLE_ROW_QUEUED_BG))
if index.column() == COL_STATUS:
color = self._status_color(self._sorted_samples[index.row()])
color = self._status_color(sample)
if color is not None:
return QBrush(qcolor(color))
elif role == Qt.ItemDataRole.ForegroundRole:
# Tinted cells get fixed dark ink: the tints stay light pastel in
# BOTH themes, so Sunset's white theme text would vanish on them.
# Pastel-tinted "#" cells get fixed dark ink: the tints stay light
# in BOTH themes, so Sunset's white theme text would vanish on
# them. The mounted-row blue is mid-tone and readable with the
# theme's own text color, so it keeps the default ink.
sample = self._sorted_samples[index.row()]
if (
index.column() == COL_STATUS
and self._status_color(self._sorted_samples[index.row()]) is not None
and sample.db_id != self.current_sample
and self._status_color(sample) is not None
):
return QBrush(qcolor(SAMPLE_STATUS_TEXT))
elif role == Qt.ItemDataRole.TextAlignmentRole: # Align text to center
@@ -220,10 +228,11 @@ class UserSampleSpreadsheet(QAbstractTableModel):
def _emit_tints_changed(self) -> None:
if self.rowCount() > 0:
# Whole span: the mounted row tints every column, not just "#".
self.dataChanged.emit(
self.index(0, COL_STATUS),
self.index(self.rowCount() - 1, COL_STATUS),
[Qt.ItemDataRole.BackgroundRole],
self.index(self.rowCount() - 1, self.columnCount() - 1),
[Qt.ItemDataRole.BackgroundRole, Qt.ItemDataRole.ForegroundRole],
)
def headerData(self, section, orientation, role=None):
+15
View File
@@ -265,6 +265,21 @@ def test_mime_data_round_trips_for_chip_drops(status_model):
assert samples.s[0].db_id == model.get_id(0).db_id
def test_mounted_row_is_blue_across_all_columns(status_model):
# Whole-row blue (not just "#") so the mounted sample is findable at a
# glance; the blue keeps the theme's own ink (no dark override).
model = status_model
model.updateCurrentSample(current_puck="P1", current_sample=1)
row = _row_of(model, 1)
for col in range(model.columnCount()):
brush = model.data(model.index(row, col), Qt.ItemDataRole.BackgroundRole)
assert brush.color().name().lower() == "#729fcf"
assert model.data(model.index(row, col), Qt.ItemDataRole.ForegroundRole) is None
# Other rows: still "#"-only tint, other columns untouched.
other = _row_of(model, 2)
assert model.data(model.index(other, 1), Qt.ItemDataRole.BackgroundRole) is None
def test_spreadsheet_param_columns(status_model):
from aarecommon.models.models import DataCollectionParameters