Skip to content

[GUI] Move pop_editeventvals to EEGLAB's supergui layout - #885

Merged
arnodelorme merged 6 commits into
developfrom
agent/issue-823-supergui
Dec 1, 2026
Merged

arnodelorme merged 6 commits into
developfrom
agent/issue-823-supergui

Conversation

@arnodelorme

Copy link
Copy Markdown
Collaborator

Event values (pop_editeventvals) now opens with the rows, row heights and controls EEGLAB gives it: it copies EEGLAB's geometry and control list and uses layout="supergui" from #878, and it joins the geometry test suite. On Linux the window has MATLAB's height (326 pixels, against 396 on develop) and every control sits within 0.4 pixel of MATLAB's row. This pull request is stacked on #884 (it needs that branch's button label rule): merge #884 first.

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

Dialog EEGLAB EEGPrep before EEGPrep after Rows after (pixels from MATLAB) Width after
pop_editeventvals 695 x 326 680 x 396 697 x 326 0.4 +0.3%

Drawn on jamming on November 29, 2026 with the epoched sample, from EEGLAB develop 5e0be870, EEGPrep develop cea86f8f (before) and this branch (after). The EEGLAB panel is drawn from the arguments pop_editeventvals.m passes to inputgui; EEGLAB fills the four value boxes right after, with pop_editeventvals('goto', 0), so they are empty in that panel only.

Fixes #823
Fixes #859

What changes
  • The empty row above Event Num, which EEGLAB has, is added.
  • Field buttons carry EEGLAB's text (latency (ms) on epoched data, latency (sec) on continuous data, the field name otherwise), which the supergui layout writes Latency (ms), Type, Epoch as supergui.m does.
  • The label "Original value below" is gone. In its place EEGLAB's original line shows originally N when the event's urevent is not its number (pop_editeventvals.m lines 199-204), and it follows the event shown while browsing. Memory keeps urevent 0-based, so N is the 0-based value plus 1.
  • pop_editeventvals: keep field buttons aligned under Windows and with longer event names #859: every field row uses the same four columns, so the field buttons and the value boxes keep one left edge and one width whatever the field names and the platform fonts. The earlier layout fitted each button to its text, which moved them by 3 pixels on Windows and by 41 pixels with a long field name.
Tests
  • tests/test_gui_geometry.py: pop_editeventvals has the geometry and controls EEGLAB passes to inputgui (case recorded from EEGLAB develop), the port returns MATLAB's positions, and on Linux the drawn dialog has MATLAB's rows. The four value boxes are left out of the value comparison because EEGLAB fills them after inputgui returns.
  • test_field_buttons_and_values_share_columns_with_a_long_field_name (pop_editeventvals: keep field buttons aligned under Windows and with longer event names #859): with a long custom field name, all field buttons share one left edge and width, and so do all value boxes; the latency button reads Latency (ms). It runs on every CI platform, Windows included.
  • tests/test_gui_geometry.py on jamming: 54 passed. Tests that touch pop_editeventvals, the supergui layout or the Qt renderer: 618 passed.

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.
Event values uses EEGLAB's geometry and uilist with layout="supergui" and joins
the geometry suite: the empty row above Event Num, EEGLAB's field button text
(latency (ms) or (sec)), and the originally N line when urevent is not the
event number, updated while browsing events.

@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 17s —— View job


Code review

  • Overall assessment: Mostly good; one small parity nit and one gap in test coverage. I checked the geometry and control list against EEGLAB develop pop_editeventvals.m and found these match: the empty [1] row, the [1.2 0.6 0.6 1 0.6 0.6 1.2] rows, the latency/duration (ms|sec) button text chosen by EEG.trials > 1, urevent left out of the field list, and the original text control. I also checked how the new "original" key moves through field_displays in qt.py. It updates the QLabel while browsing, and _run_gui only reads field_* keys, so it never turns into a changefield.
  • Highest-risk area: the originally N line after Insert, Append or Delete.
  • Merge recommendation: Safe to merge after [GUI] Move four Edit dialogs to EEGLAB's supergui layout #884. The items below can be fixed in this PR or in a follow-up.

Blocking

None.

Important

None.

Nits

  • pop_editeventvals.py _original_text (inline comment): the originally N text is worked out once, from each event's position when the dialog opens, and then moves with that event's row. After a Delete, Insert or Append moves events, it no longer matches EEGLAB. EEGLAB recomputes it on every goto with EEG.event(valnum).urevent ~= valnum. Example: delete event 3 of 10 where urevent equals the event number. EEGLAB shows originally 4 on the new event 3; EEGPrep shows nothing there. Fix: keep the 1-based urevent in the row and build the label from the row's current index. Or, if you leave it as is, add it to known_differences.

Test gaps

  • originally N is new behavior that crosses the 0-based/1-based boundary, and no test covers it. tests/test_pop_editeventvals.py only builds events with "urevent": []. A cheap spec-level test would catch a ±1 error:

    • an event at position 2 with in-memory urevent=4 gives field_displays[1]["original"] == "originally 5";
    • an event at position 1 with urevent=0 gives " ".

    The geometry reference does not cover this: it is recorded from a dataset where the initial label is ' '.

EEGLAB parity notes

  • In EEGLAB the field button opens questdlg2 with EEG.eventdescription{index}. Here it shows a generated sentence. This was already the case before this PR and is listed in known_differences, so it is not a finding.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance.

Comment on lines +356 to +362
def _original_text(event: Mapping[str, Any], number: int) -> str:
# pop_editeventvals.m lines 199-204: the urevent index when it is not the event number;
# memory keeps urevent 0-based (pop_loadset.py)
urevent = event.get("urevent")
if isinstance(urevent, (int, float, np.integer, np.floating)) and np.isfinite(urevent) and urevent + 1 != number:
return f"originally {int(urevent) + 1}"
return " "

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 (EEGLAB parity): the originally N text is worked out once, against each event's position when the dialog opens, and then travels with that event's row in field_displays. Once Delete, Insert or Append moves events to new positions, the stored text no longer matches EEGLAB.

EEGLAB recomputes it on every goto against the event's current position (pop_editeventvals.m, % update original block: EEG.event(valnum).urevent ~= valnum). Example: delete event 3 of 10, where every urevent equals its number. In EEGLAB, the event now at position 3 (urevent 4) shows originally 4. Here it stays blank, because its text was " " when the dialog opened at position 4. An inserted row also gets "" where EEGLAB shows originally <urvalnum>.

Suggested fix: keep the raw 1-based urevent in the row (for example "urevent": int(urevent) + 1), not the finished string, and have _edit_event_structure/_navigate_indexed_form build the label from the row's current index. If you'd rather not touch qt.py in this PR, record it as a known difference in known_differences so the limitation is written down.

def _original_text(event: Mapping[str, Any], number: int) -> str:
# pop_editeventvals.m lines 199-204: the urevent index when it is not the event number;
# memory keeps urevent 0-based (pop_loadset.py)
urevent = event.get("urevent")
if isinstance(urevent, (int, float, np.integer, np.floating)) and np.isfinite(urevent) and urevent + 1 != number:
return f"originally {int(urevent) + 1}"
return " "

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.

🤖 Recorded in known_differences (59f57c7) rather than changing the shared navigation code of qt.py in this pull request. The branch also merges #884's lookup fix.

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.
Found in the review of this pull request: the line is not worked out again after Delete, Insert or Append.
@arnodelorme
arnodelorme merged commit 34c89e4 into develop Dec 1, 2026
12 checks passed
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.

pop_editeventvals: keep field buttons aligned under Windows and with longer event names pop_editeventvals: rebuild the layout from EEGLAB's geometry

1 participant