Skip to content

[GUI] Align edit fields across rows using the shared dialog geometry - #846

Closed
arnodelorme wants to merge 3 commits into
developfrom
agent/issue-821
Closed

arnodelorme wants to merge 3 commits into
developfrom
agent/issue-821

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Edit fields now line up in the event field editor, event selector, channel editor and data selector. The four windows use the weighted columns that ten other windows already use, so no layout mode is added, and each window keeps its width whatever the font: 695 pixels for the data selector, which opened 1031 pixels wide on Windows with the earlier version of this pull request.

pop_select: EEGLAB, EEGPrep on develop, the earlier grid version and the weighted columns version

pop_editeventfield: EEGLAB, EEGPrep on develop, the earlier grid version and the weighted columns version

pop_selectevent: EEGLAB, EEGPrep on develop, the earlier grid version and the weighted columns version

pop_chanedit: EEGLAB, EEGPrep on develop, the earlier grid version and the weighted columns version

In each image the EEGLAB panel is the MATLAB capture on jamming that this pull request already showed. The three EEGPrep panels were drawn on November 28 by offscreen Qt on the Mac, without a title bar, from develop, from the earlier head 51e3155c (grid) and from the new head 899d8306 (weighted columns). Native captures of the new head on Linux, the Mac and Windows are not made yet.

Window Width Edit boxes start at, develop Edit boxes start at, now Height, develop Height, now
pop_select 695 248, 248, 248, 273, 273 253 for all five 404 308
pop_editeventfield 900 353, 353, 353, 354 443 for all four 360 286
pop_selectevent 960 325, 298, 415 408 for all three 500 414
pop_chanedit 872 399, 364, 397, 397 369 for all four 900 745

The four heights written by hand are gone, so the content now sets the height of these windows (rule 26), which makes them shorter. The numbers are in pixels, measured offscreen on the Mac with a dataset of three event fields and one channel.

The Word and PDF reports hold the same four images and numbers, one page per window.

Editable Word report · PDF report

Cause and change

MATLAB's supergui places a control at a fraction of the whole row. Qt sized each row by its content, so a longer label moved the edit box of its row. The four specifications now set weighted_columns=True, the existing mode that gives each cell its geometry share as supergui does. The grid layout that the earlier version added to guifunc/qt.py (_add_grid_rows, the shared_columns field) is removed. The geometry corrections are kept: the event selector uses the rows of pop_selectevent.m ([0.6 2.1 1.2 0.8] and [0.55 0.65 middlegeom 0.1 0.22 0.1]) and the channel editor uses the { 1 } header row of pop_chanedit.m.

One change remains in the shared renderer, three lines: a push button placed in a weighted cell gets 2 pixels of side padding where the style sheet gives 10. MATLAB centres a caption in its cell with no padding, and with 10 pixels the "..." buttons of the event field editor showed a single dot and "Save (other types)" of the channel editor lost two letters. A caption is centred, so a button that already had room looks the same. I drew the eight other weighted windows that build from a small dataset before and after this change: seven are identical pixel for pixel (pop_importdata, pop_importevent, pop_importerplab, pop_export, pop_chanevent, pop_importepoch, pop_study), and in pop_erpimage the button "Epoch-sorting field", which lost the edge of its first letter, now shows it whole.

Verification

No numerical code changes, so no EEGLAB parity run in MATLAB is needed.

With the text enlarged from 16 to 24 and 29 pixels through the style sheet, the four windows stay 695, 900, 960 and 872 pixels wide. The earlier grid version gave 733 and 886 pixels for pop_select and 1053 and 1281 pixels for pop_selectevent.

The five focused test files (test_guifunc_primitives.py, test_gui_pop_select.py, test_phase1b_file_edit_pop_functions.py, test_pop_editeventfield_current.py, test_pop_select.py): 154 passed, 2 skipped for MATLAB, 37 deselected. The 35 test files that build a dialog: 811 passed, 19 skipped, 4 failed. The four failures do not come from this change: three tests of test_gui_main_window.py fail the same way on the previous head, and test_real_testmff_matches_eeglab_epochs needs the module defusedxml, which the local environment does not have. Ruff check and format pass on the touched files.

test_field_columns_share_their_left_edges checks, for the four windows, that the edit boxes start within one pixel of each other, that the window has the width of its specification and that no visible caption is cut.

Fixes #821
Part of #724
Part of #728
Part of #729
Part of #731

@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

PR #846 was updated after the trigger (7ba1b8d -> 51e3155). Push again or mention Claude to run on the latest version.

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

Review (Claude Fable): needs more work

  • The alignment itself works. On head 51e3155c the edit boxes of the four windows start at one x position (offscreen run on the Mac: 247, 426, 394 and 356 px), and the new test fails on the base commit and passes on the branch.
  • The test this PR adds fails on Windows CI. test_field_columns_share_their_left_edges reports the pop_select window at 1031 px instead of 695, so "original widths are preserved" does not hold there. The other Windows failure (test_window_without_a_height_is_as_high_as_its_rows) already fails on develop and is not from this PR.
  • It adds a third layout mode instead of using the shared one. weighted_columns already sizes cells by geometry weight as supergui does (11 windows use it, and [GUI] Align pop_chanevent edit boxes vertically #716, [GUI] Align pop_export checkboxes and edit boxes #717 and [GUI] Put every pop_importepoch edit box in one column #770 fixed this same defect with it). With the geometry corrections of this PR, weighted_columns=True alone aligns all four windows at the same widths, with no new renderer code.
  • The PR body has what is needed to judge it (EEGLAB, before and after for the four windows, Word and PDF links, no numbers involved). The geometry corrections match the .m files.
Details

What I ran (worktree at 51e3155c, Python 3.11 environment of the main checkout, offscreen Qt on macOS)

  • tests/test_guifunc_primitives.py: 11 passed, 1 deselected.
  • tests/test_gui_pop_select.py, tests/test_guifunc_primitives.py, tests/test_phase1b_file_edit_pop_functions.py, tests/test_pop_editeventfield_current.py, tests/test_pop_select.py: 154 passed, 2 skipped (MATLAB), 37 deselected.
  • New test against the base sources (b9ad81c2): fails as it should, pop_select edit boxes at [248, 248, 248, 273, 273].

CI at review time: Windows 3.12 failed, Ubuntu 3.12 passed, pre-commit, Ruff and ty, docs, base install and the EEGLAB Python backend passed. macOS, Ubuntu 3.13, E1 and Pyodide were still pending.

1. Windows failure (blocking)

tests/test_guifunc_primitives.py::test_field_columns_share_their_left_edges
AssertionError: ('pop_select', 1031)   assert 1031 == 695

I could not run Windows here, so the exact cause is not confirmed. What I measured locally points to the grid: its minimum width is larger than that of the two existing layouts (pop_select minimum width hint 563 px for the grid, 496 px for the content layout), and it grows faster when text is wider. Window width when I enlarge the text through the style sheet:

window (spec width) text size grid (this PR) content (develop) weighted_columns
pop_select (695) 24 px 733 695 695
pop_select (695) 29 px 886 775 695
pop_editeventfield (900) 29 px 971 900 900
pop_selectevent (960) 29 px 1281 1281 960
pop_chanedit (872) 29 px 1177 1111 872

One likely contributor: near-equal boundaries become separate grid columns. In pop_select the header [1 1 1] and the rows [1 1 0.25 0.23 0.51] give edges at 0.3333 and 0.3344, so the grid has 8 columns and 7 gaps of 4 px where a row has 4. Please find the cause on Windows and fix it, or show that develop is equally wide there and then drop the width assertion with that evidence. A Windows capture would settle it.

2. Shared code (rule 34) and minimal change (rule 21)

The renderer now has three ways to lay out a row: content sized (default), weighted_columns (the supergui rule), and the new shared_columns grid (+53 lines in qt.py, with a special case for a row holding a single control and a size policy change for push buttons). Each window still has to opt in, so the cause is not fixed once in the mother function. It is a second opt-in flag beside the first.

I rebuilt the four specs of this branch with shared_columns=False, weighted_columns=True. All edit boxes line up at the original widths (x = 253, 443, 408 and 369 px), and the gaps between cells look closer to EEGLAB's. Two things remain with that option on these fonts: "Save (other types)" in pop_chanedit loses two letters at 872 px, and the "..." buttons of pop_editeventfield show a single dot. Both are small (fit_weighted_labels extended to push buttons, or a slightly wider window).

So the smaller change is: keep the geometry corrections of this PR, set weighted_columns=True on the four specs, and delete _add_grid_rows and the shared_columns field. If the grid is preferred because it keeps every label whole at the original width, that is a design choice for Arno, and it should then replace weighted_columns in the other windows over time, not live beside it.

3. Parity with the .m files (good)

  • pop_selectevent.m L121, L185, L200: [0.6 2.1 1.2 0.8] and [0.55 0.65 middlegeom 0.1 0.22 0.1]. The PR now uses exactly these, with the {} cells where EEGLAB has them.
  • pop_chanedit.m L321: header row { 1 }. The PR replaces (1.5, 1, 0.2, 1) plus three spacers with (1,).
  • pop_editeventfield.m L152, L167 and pop_select.m L131 were already the same.
  • Not from this PR, still different from EEGLAB: the lower rows of pop_selectevent (.m L204 [.1 2 .3 .2] [.1 1.5 0.5 0.5] [.1 1 0.5 1] [.1 1 0.5 1], Python (0.1, 3.2, 0.5), (1,), (1.6, 1), (1.6, 1)). That is why "Keep only selected events" is not indented in the capture.

4. Scope

  • The four fixed heights are removed (size=(W, None)), so the windows also change height (pop_chanedit 900 to about 745 px here). This follows rule 26 and shows in the captures, but the summary does not say it. Please add one line.
  • The sentence added to eeglab_migration.rst sits under "What Changes", yet it describes a point where EEGPrep now behaves like EEGLAB. It can go.

5. Other open pull requests

Test merges are clean against #851, #848, #844, #856, #857 and #850. #835 and #778 conflict with develop already, not with this PR. One thing to watch: #851 rewrites the row loop of build_dialog (row heights, blank rows), and the grid path of this PR bypasses that loop, so the four windows would not follow #851's row rules even though git merges both without complaint. Using weighted_columns removes that problem.

— orchestrator review

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

Code review

Independent review by Codex (OpenAI, model gpt-6.1-terra), run read-only on commit 899d8306. The change was written by Claude Fable, so this is a second opinion from another vendor. Its text is below, unchanged except for local file paths.

What was done with its findings:

  • Blocking: none. It confirms that no layout mode is added and that the geometries match the four .m files.
  • Left, a long field name can be cut. This is how weighted columns work in the ten other windows that use them, and it is what keeps pop_select at 695 pixels on Windows where the grid opened it at 1031. Rule 23 of the GUI parity rules also says that column widths are not sized by the text of the labels. A tooltip with the full text would be a separate small change.
  • Left, the 2 pixel side padding applies to the push buttons of every weighted window. All weighted windows were rendered before and after this change: they are pixel identical, except pop_erpimage, where the caption "Epoch-sorting field" was cut and is now whole. In a weighted row the cell width comes from the geometry, not from the padding, so a button does not move.
  • Left, the extra tests it asks for (long field name, wider font in the test suite, epoched rows). The width at 24 and 29 pixel text was measured by hand for this pull request (695, 900, 960 and 872 pixels in all cases), and the Windows CI job runs test_field_columns_share_their_left_edges on the new head.

— orchestrator


Overall assessment

Needs changes. The PR uses the existing weighted_columns mode. It does not add a new layout mode. The geometry control counts match the supplied controls, including the conditional event and epoch rows.

The main concern is that the new mode fixes column proportions while ignoring content width. This can make dataset field names and descriptions unreadable.

Blocking

None.

Important

Dataset text can be clipped. In pop_selectevent.py and pop_editeventfield.py, weighted columns ignore the width of field names and description buttons. A sufficiently long field name can therefore be cut off, making fields difficult to distinguish. The same risk applies to wider fonts in all four dialogs. Preserve aligned columns while providing a way to read the full text, such as a suitable tooltip or controlled width adjustment.

The button padding change has a wider scope than the four dialogs. qt.py applies a widget-level stylesheet to every button in every weighted dialog. For example, it overrides the explicit 4px padding in pop_study.py. Scope this adjustment to the dialogs that need it, or verify and intentionally update the other affected dialogs.

Nits

None.

Test gaps

The new test at test_guifunc_primitives.py checks observable alignment and is meaningful. The old renderer allocated space using content and fixed button widths, so the alignment assertion is expected to expose the original problem. I could not verify that it fails on develop or passes on this head: the targeted run stopped during collection because the read-only environment prevented Matplotlib from creating its cache.

The test uses short field names and one font. Add a case with a long event field or description and a wider font, plus a Windows run, to check both readable text and the requested window width. It should also exercise duration and epoched event rows.

EEGLAB parity notes

Width: All four specs request fixed widths and leave fit_weighted_labels disabled. qt.py ignores content size hints for weighted controls, and qt.py does not calculate a font-dependent width for these specs. Thus ordinary label or button text should not recreate the earlier 1031-pixel content-sizing expansion. Qt or the window manager can still impose minimum sizes, and I could not verify the actual width on Windows. MATLAB’s supergui.m does measure text and can expand the figure at line 442.

Geometry: The pop_select rows match pop_select.m:131. The event-field header and repeated rows match pop_editeventfield.m:152 and line 167, although EEGPrep already omitted the blank row before rename at line 227.

The changed pop_selectevent header, field variants, and indices rows match pop_selectevent.m:121, line 162, and line 185. Its later selection and epoch rows already differ from lines 204–218.

The pop_chanedit heading and ordinary field rows match pop_chanedit.m:321 and line 346. Its data-channel and lower rows already differ from lines 361–401.

The MATLAB and Python source files are primary evidence for their own behavior, credibility 10/10. Network access was unavailable, so I could not verify that the checked-out commit is still the live PR head.

@arnodelorme

Copy link
Copy Markdown
Collaborator Author

Closed at Arno's request (email of November 29, 2026). Instead of aligning pop_select, pop_editeventfield, pop_selectevent and pop_chanedit with the earlier layout, these four windows will be moved to the new supergui layout merged in #878, which fixes the cause. The work is tracked in #821.

— orchestrator

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