Skip to content

[GUI] Page the loaded STUDY dataset editor in groups of ten - #1056

Open
arnodelorme wants to merge 4 commits into
agent/issue-875-file-editoptionsfrom
agent/issue-875-file-pop-study
Open

arnodelorme wants to merge 4 commits into
agent/issue-875-file-editoptionsfrom
agent/issue-875-file-pop-study

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

Create study from loaded datasets · Stack on PR #1034. Ten displayed rows per page, with edits preserved across pages until submission.

Initial page

Second page; the earlier Qt version had only the initial window

Vertical control offsets

Stored dataset metadata

Effective component selection

Both native windows on jamming are 618 px tall. Maximum vertical control displacement is 0.49 px. Before the change EEGPrep used a fixed-height window without page controls. Cancel now discards edits across pages. Clear removes the selected datasets on submission. The component column stays wide enough for three-digit component selections.

Two edited metadata configurations agreed exactly. For a newly created Study, MATLAB uses an empty list to mean all components and EEGPrep explicitly stores IDs 1–32. The three effective selections agree. Opening and navigating these pages does not require a dipole model. The existing residual-variance selection backend remains unavailable.

EEGLAB 5e0be870, EEGPrep 90f60a36. The GUI, metadata and geometry suites passed all 135 tests on jamming. Part of #875. Fixes #1057. Addresses #708.

Full inventory report for the project team. pop_study (p. 18). PDF · Editable Word.

@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 1, 2026 •

Copy link
Copy Markdown
Contributor

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


Code review

  • Overall assessment: The changes need one fix. Paging, deferred submission, Cancel and Clear→remove work as described. One display bug remains when a page is reloaded.
  • Highest-risk area: How _edit_dataset_pages restores the component buttons on a page the user comes back to.
  • Merge recommendation: Needs changes. The fix is one line.

Blocking

None.

Important

  • The components button label goes stale after "all components" or Clear. See src/eegprep/functions/studyfunc/pop_study.py:107. The and saved[c.tag] guard skips the relabel when the saved selection is [], which means all components. The user picks all components or presses Clear, so the label reads "All comp.". After > then <, the button shows the original Comp.: 1 2 3 label again. The value submitted on Ok is still []. A cross-page propagation that writes [] to another page's row has the same problem. Fix: test c.string instead of saved[c.tag]. Blank rows past the loaded datasets have an empty label, so they stay blank. A suggestion is posted inline. Fix this →

Nits

None.

Test gaps

  • test_loaded_study_pages_keep_unsubmitted_rows_and_cancel checks text edits on a page the user returns to. It does not check the components button. Add a step: Clear dataset_1 on page 1, page forward and back, then assert widgets["dataset_1_components"].text() == "All comp.". This test would catch the issue above.

EEGLAB parity notes

  • This environment has no vendored src/eegprep/eeglab/functions/studyfunc/pop_study.m. I could not compare the header text, the bold column labels or the page-button geometry line by line against EEGLAB. Those checks rely on the visual parity captures in the PR body.
  • Before this PR, the defaults behaved the same way. ControlSpec.horizontal_alignment now defaults to None, edit boxes still center unless set to "left", and text labels left-align unless set to "center". Every existing caller passes "left" or "center" explicitly.

Checked:

  • Paging, saved-state merging and Cancel.
  • Clear→remove command ordering in _dataset_row_commands.
  • The submit_dialog Qt callback and how it reads back.
  • Cross-page component propagation.
  • The horizontal_alignment default change across callers.
  • Docs and help updates.

spec = pop_study_dialog_spec(study, datasets, page=page)
controls = tuple(
replace(c, string=format_components_button(saved[c.tag]))
if c.tag in saved and c.tag.endswith("_components") and saved[c.tag]

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: the components button label goes stale after "all components" or Clear.

saved[c.tag] is [] when the user picks all components or presses Clear. The and saved[c.tag] guard then skips the relabel. When the user returns to the page, the button still shows the spec label from the original datasetinfo (for example Comp.: 1 2 3), but its stored value, and the value submitted on Ok, is [] (all components). The same happens when a cross-page propagation (lines 133-135) writes [] to a row on another page. The user sees one selection and gets a different one.

Here is how it happens: a dataset has comps=[1,2,3]. On page 1, the user clicks Clear or selects all components, so the label reads "All comp.". They click > and then <, and the label reads "Comp.: 1 2 3" again.

Fix: use the spec's own label to decide whether to relabel. format_components_button([]) already returns "All comp.", and blank rows past the loaded datasets keep "":

Suggested change
if c.tag in saved and c.tag.endswith("_components") and saved[c.tag]
if c.tag in saved and c.tag.endswith("_components") and c.string

To cover it, extend test_loaded_study_pages_keep_unsubmitted_rows_and_cancel. On page 1, click dataset_1_clear. After paging back, assert that widgets["dataset_1_components"].text() == "All comp.".

@arnodelorme arnodelorme left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This review was written by an AI assistant during a nightly check, not by Arno.

Code review

  • Overall assessment: Safe to merge.
  • Highest-risk area: State preservation across pages, component button relabeling, and deferred row removal in _edit_dataset_pages and _dataset_row_commands.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None.

EEGLAB parity notes

None.

Checked for correctness bugs, EEGLAB parity against functions/studyfunc/pop_study.m and functions/studyfunc/std_editset.m (paging ten rows at a time, header text and alignment, supergui geometry, component selection propagation across pages for shared recordings, Cancel discard behavior, and Clear emitting remove commands in reverse index order), data structure compatibility, tests for changed behavior, and CLAUDE.md/AGENTS.md compliance.

Tests run at 58d83f0310087fe4021f7db1d3050280ab721f6a in a detached worktree: tests/test_gui_pop_study.py (19 passed), tests/test_gui_geometry.py, tests/test_guifunc_primitives.py, tests/test_study_metadata.py, and tests/test_stream9_gui_importers.py (132 passed, 35 skipped on macOS, 1 deselected), plus ruff check and ruff format --check on the modified Python files (all passed).

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

🤖 Review before taking this out of draft.

State. The updated parent (#1034, with develop) is merged in (d5353d397). On the Mac 224 tests pass and jamming passes 307 geometry tests.

Two things changed during this update.

  1. Conflict in qt.py. Develop added the accept_dialog button action and this branch added submit_dialog. Both are kept. They overlap (submit_dialog is accept_dialog plus the pressed button and an optional question), so one could later replace the other.
  2. Text alignment (a152ce7df). This branch had changed the default alignment of every control to "none" so that the header and "Page N" could be centered. After the merge that made develop's dialog tests fail (those that compare each control with the EEGLAB recording). I measured EEGLAB on jamming (MATLAB R2025b, EEGLAB 3dd650cc7): a text asked with 'HorizontalAlignment' 'center' comes out of supergui left aligned, because supergui.m line 479 sets every text to the left. So develop's rule is restored (text on the left, edit boxes centered unless asked left) and the two labels are left aligned as in EEGLAB.

The earlier finding on the components button (old label after "all components" or Clear) is fixed in 58d83f031.

Verdict: ready for review.

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