Skip to content

[GUI] Page the STUDY dataset browser in groups of ten - #1054

Open
arnodelorme wants to merge 3 commits into
agent/issue-875-file-participantinfofrom
agent/issue-875-file-studywizard
Open

arnodelorme wants to merge 3 commits into
agent/issue-875-file-participantinfofrom
agent/issue-875-file-studywizard

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

The browse wizard opens its dataset grid with ten rows and working page arrows. Filenames, subjects, conditions and other fields are preserved when paging. Another page can be used to add recordings. Stacked on #1052 (agent/issue-875-file-participantinfo).

EEGLAB, EEGPrep before, EEGPrep after

Native geometry and same-input distances

Measurements and verification

Native client dimensions on jamming were 1102.2 × 484.7 px in MATLAB, 1186 × 550 before and 1111 × 485 after. The native window measures 1102 × 485 px. Qt measures 1111 × 485 after the change, versus 1186 × 550 before. Three actual Qt submissions (one, two and three datasets) matched the public scripted MATLAB wizard in dataset count and every filename, subject and condition. The three-dataset Qt case used the second page. The MATLAB screenshot is from the actual GUI; automated entry into that GUI did not complete, so the numerical comparison uses its scripted route. The 40-file regression confirms that record 40 can be edited by paging without enlarging the window. The Qt capture used the guarded checkout on PYTHONPATH.

Closes #1055. Part of #875.

Full inventory report for the project team. pop_studywizard (p. 16). PDF · Editable Word.

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

🤖 Review before taking this out of draft (last of the File chain).

State. The updated parent (#1052) is merged in (69715768c). On the Mac 286 tests pass and jamming passes 307 geometry tests.

What I checked against pop_studywizard.m. Ten rows per page with the <, "Page N" and > controls of lines 146 to 148, the row numbers follow the page, and all pages are read when Ok is pressed.

Findings, none blocking.

  1. Two paging mechanisms. [GUI] Page the loaded STUDY dataset editor in groups of ten #1056 pages pop_study by closing and rebuilding the form, this one swaps the contents of the ten rows in place. One shared helper would be less code to maintain.
  2. The default subject name (S1, S2 and so on) is now written in three places: the dialog specification, the command builder and _bind_studywizard_pages. One constant or helper would keep them in step.

Verdict: ready for review.

@arnodelorme
arnodelorme marked this pull request as ready for review December 2, 2026 05:50

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization has no extra usage available to pay for this review.

If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.

Once extra usage is available, someone with write access to this repository can comment @claude review on this pull request to trigger a review.

@claude

claude Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @arnodelorme's task in 1m 10s —— View job


Code review

  • Overall assessment: I found no correctness bugs. I traced the paging path through _bind_studywizard_pages: store runs on every page change and again at Ok, a page left blank drops its rows, and result["pages"] replaces the ten visible file1..file10 values in pop_studywizard. With 40 files, records 11–40 still reach std_editset without being visited. Clear and Browse act on the visible slots, and store reads those slots, so both work on later pages.
  • Highest-risk area: the pager now exists three times (see Important).
  • Merge recommendation: safe to merge once the help text is fixed. The other items can be follow-ups.

Blocking

None.

Important

  1. The Help text describes the old grid. In src/eegprep/resources/help/pop_studywizard.md line 3, Help still says the wizard "opens a grid of at least 10 numbered rows, filled with any files passed in." With this PR the grid always shows 10 rows and extra files go to later pages, which users reach with < / >. The Sphinx page was updated but the Help resource was not. AGENTS.md says that for GUI dialogs with a Help button you should "add or update the corresponding Markdown help resource." Fix: replace the first sentence with something like: "pop_studywizard opens a page of 10 numbered rows, filled with any files passed in. Use < and > below the grid to move between pages; entries on every page are kept and submitted when you press Ok."
  2. A third pager for the same grid (inline). Arno's comment already notes that this PR and [GUI] Page the loaded STUDY dataset editor in groups of ten #1056 page in different ways. A third pager also exists: bids_tools._export_grid_dialog already pages this same pop_studywizard.m 10-row grid, with its own save_page and row renumbering. AGENTS.md calls out "Parallel implementations of existing helpers." Fix: in a follow-up, move the BIDS exporter grid onto studywizard_pages, and put the S{n} default in one place at the same time. A tracking issue is enough if you don't want to grow this PR.

Nits

  • pop_studywizard.py:32 is dead now that the name edit is gone, and the docstring at line 23 ("one row per file") no longer matches the grid (inline).

Test gaps

None. The updated 40-file test pages forward to record 40, edits it, pages back and forth, and checks the edit is kept. That covers the main regression risk. A possible addition, not required: press Ok after editing a row on page 2 and assert the returned result["pages"] contains subject{N}. That would also cover the submit path.

EEGLAB parity notes

None I could confirm. The pinned EEGLAB checkout (src/eegprep/eeglab/) is empty in this CI clone, so I couldn't re-read pop_studywizard.m lines 146–148 myself. What I checked: the window title "Create a new STUDY set", the "Select datasets" header with no STUDY name field, and the < / Page N / > row all match the MATLAB screenshot in the PR body. One consequence to be aware of: from the menu, the STUDY name now always defaults to EEGPrep study. That matches EEGLAB, where the name is edited afterwards in pop_study.

Checked: correctness of the paging state, how the result reaches pop_studywizard, the test changes, and docs/help compliance with CLAUDE.md/AGENTS.md.

dialog.accepted.connect(capture)


def _bind_studywizard_pages(widgets: Mapping[str, Any], filenames: Sequence[str]) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important (maintainability). This is the third pager for the same pop_studywizard.m grid. bids_tools._export_grid_dialog (

def _export_grid_dialog() -> _ExportGrid:
"""Build the 10-row ``pop_studywizard`` page without showing it."""
try:
from PySide6.QtWidgets import (
QDialog,
QFileDialog,
QGridLayout,
QHBoxLayout,
QLabel,
QLineEdit,
QPushButton,
QVBoxLayout,
)
except ImportError as exc:
raise ImportError(
"bids_exporter: the export grid needs PySide6. "
"Install it with `pip install eegprep[gui]`, then open the wizard again."
) from exc
dialog = QDialog()
dialog.setWindowTitle("BIDS export wizard -- bids_exporter()")
state: dict[str, Any] = {
"page": 0,
"rows": [{field: "" for field in _WIZARD_FIELDS} for _ in range(_WIZARD_PAGE_ROWS)],
}
edits: list[dict[str, Any]] = []
row_numbers: list[Any] = []
grid = QGridLayout()
for column, header in enumerate(_WIZARD_HEADERS):
label = QLabel(header)
label.setObjectName(f"header-{column}")
grid.addWidget(label, 0, column)
for column, weight in enumerate(_WIZARD_ROW):
grid.setColumnStretch(column, max(1, round(weight * 100)))
for row in range(1, _WIZARD_PAGE_ROWS + 1):
widgets: dict[str, Any] = {}
number = QLabel(str(row))
number.setObjectName(f"row{row}")
row_numbers.append(number)
grid.addWidget(number, row, 0)
file_edit = QLineEdit()
file_edit.setObjectName(f"file{row}")
widgets["file"] = file_edit
grid.addWidget(file_edit, row, 1)
browse = QPushButton("...")
browse.setObjectName(f"browse{row}")
def choose(edit: Any = file_edit) -> None:
name, _selected = QFileDialog.getOpenFileName(dialog, "Choose dataset to add -- pop_studywizard()")
if name:
edit.setText(name)
browse.clicked.connect(choose)
grid.addWidget(browse, row, 2)
for column, field in enumerate(_WIZARD_FIELDS[1:], start=3):
edit = QLineEdit()
edit.setObjectName(f"{field}{row}")
widgets[field] = edit
grid.addWidget(edit, row, column)
clear = QPushButton("Clear")
clear.setObjectName(f"clear{row}")
def wipe(_checked: bool = False, row_widgets: dict[str, Any] = widgets) -> None:
for edit in row_widgets.values():
edit.setText("")
clear.clicked.connect(wipe)
grid.addWidget(clear, row, len(_WIZARD_FIELDS) + 2)
) already builds a 10-row grid with </>, row renumbering and save_page. #1056 then adds a rebuild-based pager to pop_study. AGENTS.md lists "Parallel implementations of existing helpers" as a failure pattern. A bug fix in one pager (for example how rows are kept or which subject default is used) won't reach the others.

Suggested fix: keep this callback-based binder, since it fits the declarative DialogSpec route, and move bids_exporter_grid_spec / _export_grid_dialog onto it in a follow-up. That PR can also put the S{n} default in one place. If you'd rather not grow this PR, a tracking issue is enough.

@@ -30,6 +30,8 @@ def pop_studywizard(
if not result:
return (None, [], "") if return_com else (None, [])
name = str(result.get("name") or name).strip() or name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit. This PR removes the name edit from the dialog spec, so result.get("name") is always None and the line does nothing. AGENTS.md: "Remove imports, variables, functions, and files that your change made unused." The function docstring above also still says "shows one row per file", but the grid now shows a 10-row page.

Suggested change
name = str(result.get("name") or name).strip() or name

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant