Skip to content

[GUI] Move four Edit dialogs to EEGLAB's supergui layout - #884

Merged
arnodelorme merged 3 commits into
developfrom
agent/issue-821-supergui
Nov 30, 2026
Merged

arnodelorme merged 3 commits into
developfrom
agent/issue-821-supergui

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Four Edit menu dialogs now open with the rows, row heights and controls EEGLAB gives them: Select data (pop_select), Event fields (pop_editeventfield), Select epochs or events (pop_selectevent) and Channel locations (pop_chanedit). Each copies EEGLAB's geometry and control list unchanged and uses layout="supergui" from #878; the four join the geometry test suite. On Linux each window has MATLAB's height and every control sits within 0.7 pixel of MATLAB's row.

pop_select: EEGLAB, EEGPrep on develop, EEGPrep with this pull request

pop_editeventfield: EEGLAB, EEGPrep on develop, EEGPrep with this pull request

pop_selectevent: EEGLAB, EEGPrep on develop, EEGPrep with this pull request

pop_chanedit: EEGLAB, EEGPrep on develop, EEGPrep with this pull request

Dialog EEGLAB EEGPrep before EEGPrep after Rows after (pixels from MATLAB) Width after
pop_select 715 x 300 695 x 444 724 x 300 0.7 +1.3%
pop_editeventfield 1029 x 273 900 x 396 1003 x 273 0.6 -2.5%
pop_selectevent 1181 x 485 960 x 600 1189 x 485 0.7 +0.7%
pop_chanedit 890 x 671 872 x 990 907 x 671 0.7 +1.9%

Drawn on jamming on November 29, 2026 with the epoched sample, from EEGLAB develop 5e0be870, EEGPrep develop cea86f8f (before) and this branch (after). Widths differ because Qt measures text slightly differently from MATLAB, as in #878. One difference stays on purpose: EEGPrep's buttons keep their grey Qt colour (EEGLAB's are light blue), which this change does not touch.

Fixes #821

What changes besides the layout
  • Shared code. supergui.m (lines 387-394) gives every button label a capital first letter and lower case after it; button_text in guifunc/supergui.py ports that rule, and the supergui renderer applies it. MATLAB R2025b draws a label as HTML, which collapses runs of spaces, so the renderer does too, and it writes & as && so Qt shows it (Xyz -> polar & sph. showed as Xyz -> polar _sph.). Only dialogs with layout="supergui" are affected.
  • Event fields. The epoch field is no longer listed, as in pop_editeventfield.m lines 130-133. The description buttons carry the stored first row of each description, as EEGLAB's do.
  • Select events. Rows, column weights and the empty row follow pop_selectevent.m; the field buttons show the stored description (no description when there is none) instead of the field name.
  • Channel locations. The first row holds only the title, the "Channel in data array" row has EEGLAB's own weights and the last row only the Overwrite checkbox. urchan is an edit box counted from 1, as in EEGLAB: it showed the 0-based value kept in memory. A changefield on urchan (from the window or a script) now converts EEGLAB's 1-based index to the 0-based memory value, and the datachan checkbox can be changed, as in EEGLAB. Numbers show as MATLAB's num2str writes them (84.9812, not 84.981; 0, not -0).
Tests
  • tests/test_gui_geometry.py: the four dialogs have the geometry and controls EEGLAB passes to inputgui (cases recorded from EEGLAB develop with record_geometry.m), the port returns MATLAB's positions given MATLAB's text extents, and on Linux the drawn dialogs have MATLAB's rows and aligned edit boxes. One value differs on purpose: pop_chanedit.m line 347 tests a field named urchans, which never exists, so EEGLAB starts with an empty urchan box; EEGPrep shows the index. button_text is tested against the cases of supergui.m.
  • test_pop_chanedit_shows_and_edits_urchan_one_based fails on develop (the window showed 0) and passes here.
  • Two existing assertions expected the field name on the description buttons of Select events; they now expect EEGLAB's label.
  • Full suite without MATLAB: 3614 passed, 177 skipped. tests/test_gui_geometry.py on jamming: 51 passed.
  • test_pop_chanedit_lookup_keeps_urchan_zero_based: Look up locs stored urchan from 1 while memory counts it from 0, so the window showed 2 for channel 1 and pop_saveset wrote 2 (found in review, fixed in a61e965; it failed with [1, 2] before).
EEGLAB reference run

Workflow eeglab-reference.yml (EEGLAB reference, workflow_dispatch) on this branch at a61e9650: https://github.com/sccn/eegprep/actions/runs/46314097404. EEGLAB d0963be9 and eeglab_tests fec88f9f (the commits pinned in tests/eeglab_tests/__init__.py), real MATLAB backend through matlab-batch. All seven shards passed: 4,671 passed, 58 skipped, 0 failed, 24 minutes from start to end. Of the skips listed by reason, 35 are heavy reference tests that run only with --run-heavy-reference; the others need the AMICA binary, a Windows drive, a named host, or the neuroscanio, ERPSS and openbdf plugins, none of which this change touches. The only later commit, 4722da2e, changes the changelog alone.

Select data, Event fields, Select epochs or events and Channel locations use
EEGLAB's geometry and uilist with layout="supergui", and join the geometry
suite. Button labels follow supergui.m (capital first letter), runs of spaces
collapse as in MATLAB, and & shows as itself. Event fields hides the epoch
field and both event dialogs label field buttons with the stored description.
Channel locations edits urchan (1-based, as in EEGLAB) and datachan.

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

Copy link
Copy Markdown
Contributor

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


Code review

  • Overall assessment: Needs changes. The layout part looks right. I checked the geometry and control lists against the recorded EEGLAB cases, the button_text port of supergui.m lines 387-394, the & → && and space-collapsing rule in qt.py, and the removal of the epoch field from Event fields. I also checked that the urchan and datachan edits round-trip through _store_form_edits and _change_field.
  • Highest-risk area: pop_chanedit now shows urchan counting from 1, but not every code path stores it counting from 0.
  • Merge recommendation: Needs changes.

Blocking

None.

Important

  • pop_chanedit: after "Look up locs", urchan shows one too high (_display_channel_value, pop_chanedit.py:605-608). The new display adds 1 to the stored value, which assumes it counts from 0. _lookup_chanlocs (pop_chanedit.py:853) stores index + 1, and tests/test_eeglab_execmenu.py:199 locks that in. After a lookup (the Look up locs button or the automatic lookup prompt), channel 1 shows 2. Saving such a dataset already wrote 2 before this PR. This PR makes the wrong value visible in the window. Fix: set "urchan": index in _lookup_chanlocs and update test_eeglab_execmenu.py:199 to expect 0. Inline comment posted.

Nits

None.

Test gaps

  • Add a test that runs pop_chanedit(eeg, 'lookup', <montage>) and then pop_chanedit_dialog_spec, and checks that field_urchan == "1" for channel 1. Today's new test only covers datasets loaded with pop_loadset, where memory already counts from 0.

EEGLAB parity notes

  • The PR keeps one difference from EEGLAB on purpose: EEGLAB starts with an empty urchan box because pop_chanedit.m line 347 tests a field named urchans that never exists, and EEGPrep shows the index instead. This is documented in SHOWN_VALUES and covered by the geometry test, which is fine.
  • changefield on urchan now takes EEGLAB's 1-based index, matching EEGLAB's history commands. This changes pop_chanedit output, so the EEGLAB reference workflow result still needs to go in the PR body before merging, as the description says.

I could not run tests in this job: the sandbox refused uv run pytest. These findings come from reading the code.

Comment on lines +605 to +608
if field == "urchan":
# urchan is 0-based in memory (pop_loadset.py) and 1-based in EEGLAB's window
urchan = chan.get("urchan", "")
return _display_value(urchan + 1 if isinstance(urchan, (int, float, np.integer, np.floating)) else urchan)

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: after "Look up locs" the window shows urchan one too high.

This +1 assumes urchan is stored counting from 0 (pop_loadset, pop_loadbv, pop_saveset). But _lookup_chanlocs stores it counting from 1 (

"type": channel.get("type", ""),
"urchan": index + 1,
"ref": "",
), and tests/test_eeglab_execmenu.py:199 asserts urchan == 1 for channel 1 after a lookup. So if you click Look up locs, or let the dialog's automatic lookup prompt run, the window re-renders with channel 1 showing 2. A saved dataset then writes 2 to the .set file. The saving part was already wrong before this PR. What this PR adds is that the wrong value now shows in the window.

Suggested fix: in _lookup_chanlocs, set "urchan": index so that all stored values count from 0. Update test_eeglab_execmenu.py:199 to expect 0. Then add a test where a lookup is followed by pop_chanedit_dialog_spec, and check that field_urchan == "1" for channel 1.

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.

🤖 Fixed in a61e965: _lookup_chanlocs now stores urchan from 0, test_eeglab_execmenu.py expects 0, and test_pop_chanedit_lookup_keeps_urchan_zero_based runs a lookup then checks the window shows 1 for channel 1 (it failed with [1, 2] before the fix). The EEGLAB reference workflow is running again on this head.

Look up locs stored urchan from 1 while memory counts it from 0, so the window showed 2 for channel 1 and pop_saveset wrote 2. Found in the review of this pull request.
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.

Vertical alignment of edit boxes in pop_editeventfield, pop_selectevent, pop_chanedit and pop_select

1 participant