From 326100b302bc14bb5d9a90a6f5aa424e7ca5d6a5 Mon Sep 17 00:00:00 2001 From: Dawn Date: Mon, 17 Aug 2026 14:01:28 +0200 Subject: [PATCH] fix: order sample count columns by workflow, unwire crossed columns Both bottom-dock tables now list mount -> raster -> screening -> rotation, the order the work actually happens in. In the Auxiliary table the swap also fixes a real bug: data() feeds get_entry header-index-minus-1, but rotation/raster were crossed against the header, so 'Raster count' displayed rotation counts and vice versa. Co-Authored-By: Claude Fable 5 --- src/aare/gui/models/user_sample_model.py | 8 +++++--- src/aare/gui/panels/reference_tools_panel.py | 12 ++++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/aare/gui/models/user_sample_model.py b/src/aare/gui/models/user_sample_model.py index 207234a5..8d8fc512 100644 --- a/src/aare/gui/models/user_sample_model.py +++ b/src/aare/gui/models/user_sample_model.py @@ -40,9 +40,9 @@ def get_entry(sample: SampleShortInfo, column: int): elif column == 8: return sample.raster_count elif column == 9: - return sample.rotation_count - elif column == 10: return sample.screening_count + elif column == 10: + return sample.rotation_count elif column == 11: return sample.comment return "" @@ -70,8 +70,10 @@ class UserSampleSpreadsheet(QAbstractTableModel): "User", "Mount count", "Raster count", - "Rotation count", + # Workflow order: a sample is screened before rotation data is + # collected, so Screening sits left of Rotation. "Screening count", + "Rotation count", "Comment", ] self.current_sample = current_sample diff --git a/src/aare/gui/panels/reference_tools_panel.py b/src/aare/gui/panels/reference_tools_panel.py index 8710db23..6095a3ab 100644 --- a/src/aare/gui/panels/reference_tools_panel.py +++ b/src/aare/gui/panels/reference_tools_panel.py @@ -20,12 +20,16 @@ def get_entry(sample: SampleShortInfo, column: int): return sample.sample_name elif column == 2: return sample.mount_count + # data() feeds this `header index - 1`: rotation/raster were cross-wired + # against the header, so "Raster count" showed rotation counts and vice + # versa. Order now matches the header (workflow order, same as the Dewar + # table): mount -> raster -> screening -> rotation. elif column == 3: - return sample.rotation_count - elif column == 4: return sample.raster_count - elif column == 5: + elif column == 4: return sample.screening_count + elif column == 5: + return sample.rotation_count return "" @@ -48,8 +52,8 @@ class ReferenceToolsModel(QAbstractTableModel): "Sample name", "Mount count", "Raster count", - "Rotation count", "Screening count", + "Rotation count", ] self._sort_col = 1 self._sort_order = Qt.SortOrder.AscendingOrder