Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pyoncatng's `OncatLogin` and `IPTSTable`:
3. Select runs in the table: click selects one run, Ctrl/Cmd+click toggles a run,
Shift+click selects a range, and double-click selects every run with the same
title. Ctrl/Cmd+double-click adds that title group to the selection.
Runs without a title are greyed out and cannot be selected or fetched.
4. Click **Clear Selection** to deselect all highlighted runs and start over.
Like **Fetch Runs**, this button is enabled only while the table has a
selection. Clearing the selection disables both buttons again.
Expand Down Expand Up @@ -67,8 +68,8 @@ The four buttons are enabled only while the role table has a selection. After
each click the selection is cleared, and a status line below the buttons
reports how many runs were assigned or removed.

Each row is colored by its role: white for sample, light pink for background
and light blue for empty cell.
Each row is colored by its role: white for sample, pale amber for background
and light green for empty cell.

Exporting the `usansred` JSON configuration is planned for a subsequent
iteration.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ file = "src/usansemble/_version.py"
preview = ["pixi-build"] # Required until the build feature becomes stable
channels = [
"conda-forge",
"neutrons/label/rc", # hosts the pyoncatng rc builds
"neutrons/label/main", # hosts the pyoncatng builds
Comment thread
jmborr marked this conversation as resolved.
Resolved
"oncat", # hosts the pyoncat package (pulled in by pyoncatng)
"https://prefix.dev/pixi-build-backends", # Required for pixi build
]
Expand Down
4 changes: 2 additions & 2 deletions src/usansemble/widgets/role_cast_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
removes only the selected runs. The buttons are enabled only while the table
holds a selection.

Each row is colored by its role: white for sample, light pink for background,
Each row is colored by its role: white for sample, pale amber for background,
light green for empty cell. AG Grid's ``rowClassRules`` give a row one CSS class
per role, testing the hidden ``_role`` value rather than the display label, and
:data:`ROLE_CSS` colors those classes. The Name column is given most of the
Expand Down Expand Up @@ -61,7 +61,7 @@
}
ROLE_ROW_COLORS = {
MeasurementType.SAMPLE: "#ffffff",
MeasurementType.BACKGROUND: "#fce4ec", # light pink
MeasurementType.BACKGROUND: "#fff8e1", # pale amber
MeasurementType.EMPTY_CELL: "#e8f5e9", # light green
}
# AG Grid draws the selection as a translucent layer over the row (a ``::before``
Expand Down
4 changes: 3 additions & 1 deletion src/usansemble/widgets/runs_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,9 @@ def _configure_grid(self) -> None:
ui.add_css(EMPTY_TITLE_ROW_CSS)
grid = self._table._table
grid.options[":onCellDoubleClicked"] = _SELECT_BY_TITLE_JS
grid.options[":isRowSelectable"] = f"(node) => ({_HAS_TITLE_JS})(node.data)"
# ``RunTable`` configures ``rowSelection`` as an object, and AG Grid then
# reads the predicate from that object, ignoring the top-level option.
grid.options["rowSelection"][":isRowSelectable"] = f"(node) => ({_HAS_TITLE_JS})(node.data)"
grid.options.setdefault("rowClassRules", {})
grid.options["rowClassRules"][f":{DISABLED_TITLE_ROW_CLASS}"] = f"(params) => !({_HAS_TITLE_JS})(params.data)"
# Push the new option in case the widget is built after the client connected.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_role_cast_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ async def test_row_class_rules_survive_a_redraw(user: User) -> None:
def test_role_css_colors_each_role() -> None:
assert ROLE_ROW_COLORS == {
MeasurementType.SAMPLE: "#ffffff",
MeasurementType.BACKGROUND: "#fce4ec",
MeasurementType.BACKGROUND: "#fff8e1",
MeasurementType.EMPTY_CELL: "#e8f5e9",
}
for role, css_class in ROLE_ROW_CLASSES.items():
Expand Down
6 changes: 5 additions & 1 deletion tests/test_runs_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@ async def test_runs_selector_disables_rows_without_titles(user: User) -> None:
selector = _selector(user)
options = selector.table._table.options

selectable = options[":isRowSelectable"]
# AG Grid ignores a top-level ``isRowSelectable`` when ``rowSelection`` is an
# object, so the predicate must live inside it.
assert isinstance(options["rowSelection"], dict)
assert ":isRowSelectable" not in options
selectable = options["rowSelection"][":isRowSelectable"]
assert json.dumps(TITLE_COLUMN) in selectable
assert 'String(value).trim() !== ""' in selectable

Expand Down
Loading