From d5a7074ec1d528514acfb082b5806fc14720cdea Mon Sep 17 00:00:00 2001 From: Dawn Date: Thu, 10 Sep 2026 16:57:24 +0200 Subject: [PATCH] feat: compact sample list headers, move Comment column Count columns use glyphs instead of long headers to save width, Comment moves ahead of the data-collection params, transmission shown as the stored value instead of percent. Co-Authored-By: Claude Fable 5.1 --- src/aare/gui/models/user_sample_model.py | 24 ++++++++++++------------ tests/unit/gui/test_models.py | 5 +++-- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/aare/gui/models/user_sample_model.py b/src/aare/gui/models/user_sample_model.py index 4fbd7b30..9751862f 100644 --- a/src/aare/gui/models/user_sample_model.py +++ b/src/aare/gui/models/user_sample_model.py @@ -46,17 +46,17 @@ def get_entry(sample: SampleShortInfo, column: int): # Data-collection params straight from the AareDB spreadsheet (filled by # spreadsheetupdater). Nullable: samples without params show blank. elif column == 11: - return sample.aaredb_params.oscillation if sample.aaredb_params else None + return sample.comment elif column == 12: - return sample.aaredb_params.exposure if sample.aaredb_params else None + return sample.aaredb_params.oscillation if sample.aaredb_params else None elif column == 13: - return sample.aaredb_params.totalangle if sample.aaredb_params else None + return sample.aaredb_params.exposure if sample.aaredb_params else None elif column == 14: + return sample.aaredb_params.totalangle if sample.aaredb_params else None + elif column == 15: # Model holds a 0-1 fraction; users think in spreadsheet percent. t = sample.aaredb_params.transmission if sample.aaredb_params else None - return None if t is None else round(t * 100, 1) - elif column == 15: - return sample.comment + return None if t is None else t return "" @@ -80,17 +80,17 @@ class UserSampleSpreadsheet(QAbstractTableModel): "Location", "Priority", "User", - "Mount count", - "Raster count", + "⧂", # Mount count + "▦", # Raster count # Workflow order: a sample is screened before rotation data is # collected, so Screening sits left of Rotation. - "Screening count", - "Rotation count", + "⌕", # Screening count + "↻", # Rotation count + "Comment", "Oscillation (°)", "Exposure (s)", "Total range (°)", - "Transmission (%)", - "Comment", + "Transmission", ] self.current_sample = current_sample self.current_puck = current_puck diff --git a/tests/unit/gui/test_models.py b/tests/unit/gui/test_models.py index 58868d6a..e11ec6a6 100644 --- a/tests/unit/gui/test_models.py +++ b/tests/unit/gui/test_models.py @@ -289,14 +289,15 @@ def test_spreadsheet_param_columns(status_model): hdr.index("Oscillation (°)"), hdr.index("Exposure (s)"), hdr.index("Total range (°)"), - hdr.index("Transmission (%)"), + hdr.index("Transmission"), ) model.get_id(_row_of(model, 1)).aaredb_params = DataCollectionParameters( oscillation=0.1, exposure=0.01, totalangle=360, transmission=0.125 ) row = _row_of(model, 1) d = lambda c: model.data(model.index(row, c), Qt.ItemDataRole.DisplayRole) - assert (d(osc), d(exp), d(tot), d(trans)) == (0.1, 0.01, 360, 12.5) + # Transmission shown as stored, no percent conversion. + assert (d(osc), d(exp), d(tot), d(trans)) == (0.1, 0.01, 360, 0.125) # No params -> blank, and sorting a mostly-None column must not raise; # the real value sorts first. assert model.data(model.index(_row_of(model, 2), osc), Qt.ItemDataRole.DisplayRole) is None