Repository navigation
[GUI] Lay out dialogs as EEGLAB's supergui does, with a geometry test suite of ten dialogs - #878
Conversation
There was a problem hiding this comment.
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 finished @arnodelorme's task in 1m 16s —— View job Code review
BlockingNone. Important
NitsNone. Test gapsNone. EEGLAB parity notes
Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance. |
| self._apply_font_hints(widget, control) | ||
| self._apply_widget_size_policy(QtWidgets, widget, style) | ||
| widget.setEnabled(control.enabled) | ||
| widget.setVisible(control.visible) |
There was a problem hiding this comment.
Important: every control in every dialog briefly becomes its own top-level window.
_build_widget creates its widgets without a parent (QtWidgets.QLabel(control.string), QtWidgets.QLineEdit(...), and so on). On a parentless widget, setVisible(True) is the same as show(): Qt creates a native top-level window for it right away. The window goes away only when layout.addWidget reparents the widget. This runs for all dialogs, including those still on layout="qt", because both paths go through _build_widget. On a real desktop (xcb, Windows, macOS) this can make windows flash and creates one native window per control. The offscreen tests do not catch it.
Only hiding needs to be explicit. An explicitly hidden child stays hidden when it is reparented and when its parent is shown, so pop_firws's dev field still works:
| widget.setVisible(control.visible) | |
| if not control.visible: | |
| widget.hide() |
eegprep/src/eegprep/functions/guifunc/qt.py
Lines 462 to 466 in 63848ac
|
🤖 The finding is right and is fixed in |
The same geometry now gives the same window in EEGLAB and in EEGPrep. EEGPrep's
superguiis rewritten as a port of the arithmetic ofsupergui.mandinputgui.m(borders, spacing, row and column shares, the empty row and the row of Help, Cancel and Ok), ten dialogs are moved to it, and a geometry test suite of these ten dialogs stays in the repository. The text of an edit box is centered in every dialog, as in MATLAB.On Linux (jamming, MATLAB R2025b) the ten EEGPrep windows have MATLAB's height, their rows sit within 0.7 pixel of MATLAB's, and their edit boxes line up as in MATLAB. A vision model (Codex, gpt-6.1-terra) finds the ten pairs close enough on the five rules of the issue; it rejects the ten pairs taken from develop.
pop_resamplepop_rmbasepop_rerefpop_autorejpop_eegthreshpop_rejspecpop_plottopopop_firwspop_dipfit_gridsearchpop_iclabelWindow sizes are in pixels, drawn on jamming on November 29, 2026 from EEGLAB
579a27d0, EEGPrep develope435f436(before) and this branch at63848ac1(after). Both checkouts were compared with the develop branch before the captures. The EEGPrep checkout on jamming was 54 commits behind when the work started.What remains different, and what is not in this pull request
The windows are up to 1.4% wider than MATLAB's, because Qt measures text slightly wider than MATLAB does. Text sits 2 pixels lower inside each control, the same for labels, edit boxes and checkboxes, so their alignment is kept. The shape of buttons, check marks and popup arrows belongs to Qt and is not changed.
Only these ten dialogs use the new layout (
layout="supergui"in their specification). The other dialogs keep the earlier layout until they are moved one by one, each with its captures. The only change they see is the centered text of edit boxes. A window taller than the screen does not scroll in the new layout, as in MATLAB. The Mac and Windows height factors ofsupergui.mare ported and not yet compared on those systems.Cause and change
supergui.mgives every control a rectangle computed from the geometry alone, then scales the figure by the largest text extent, andinputgui.mappends an empty row and a row of four cells for the buttons. EEGPrep stacked Qt layouts that size each row by its content, with a margin above the buttons, so each dialog needed its own size, margins and spacing.guifunc/supergui.py:getcoord, the conversion ofgeomhorizandgeomvert, the figure width and height factors, the text shift, andadjustbuttonsofinputgui.m, as pure functions with MATLAB's parameter names and defaults (borders,spacing,minwidth,skipline,addbuttons).guifunc/qt.py: forlayout="supergui", measures the text of each control as MATLAB'sExtentdoes and places each widget at its rectangle. Controls keep their share of the window when it is resized, as MATLAB's normalized units do.guifunc/spec.py:layout,borders,spacing,minwidth,skipline,addbuttonsonDialogSpec;visibleandfit_widthonControlSpec; edit text centered by default.size, margins and spacing.pop_dipfit_gridsearchtakes EEGLAB's column widths[1 0.6], and the hidden field ofpop_firwsis hidden as in EEGLAB instead of showing an extra row.pop_importdata,pop_editset,pop_importevent,pop_importepoch,pop_editeventfield, the BIDS dialogs) now say so in their specification.The geometry test suite (tools/gui_geometry) and tests
cases/: the geometry and the control list each EEGLAB function passes toinputgui, recorded from EEGLAB itself bymatlab/record_geometry.mwith a stand-ininputgui, so no window opens and no data is needed to draw.matlab/draw_geometry.manddraw_geometry.py: the two standalone scripts, fed the same case, each writing the image and the pixel position of every control.compare_positions.py,pair_images.py,vision_rules.md,run_linux.sh: the comparison in pixels, the pairs and the rules for the vision model, and the whole run on Linux, which first prints how far each checkout is behind develop.tests/test_gui_geometry.py, 30 tests: given MATLAB's text extents the port returns MATLAB's control positions within 1 pixel (any platform, no MATLAB); the ten EEGPrep dialogs have the recorded geometry; on Linux the drawn dialogs have MATLAB's rows and aligned edit boxes.On the final commit
48217a52the test jobs pass on Ubuntu (Python 3.12 and 3.13), macOS and Windows, with the documentation build, the EEGLAB Python backend job, Ruff, ty and pre-commit. The 30 geometry tests pass on jamming on the final commit48217a52, whose twenty Python images are identical, byte for byte, to those of63848ac1shown above.The automatic review found that every control was briefly shown as a window of its own before it joined the dialog (
setVisible(True)on a widget with no parent). Commit5d660fd6hides only the hidden controls. The first Windows run failed because Qt reports a font size of 0 on the Windows runner, which has no fonts, so the text measure gave a window of height 0. Commit48217a52reads the size the stylesheet sets.Report, one page per dialog, EEGLAB beside EEGPrep, before and after: PDF · editable Word
Fixes #875