Skip to content

[GUI] Match the resizable dataset comments figure - #929

Merged
arnodelorme merged 3 commits into
developfrom
agent/issue-925-comments
Dec 1, 2026
Merged

arnodelorme merged 3 commits into
developfrom
agent/issue-925-comments

Conversation

@arnodelorme

@arnodelorme arnodelorme commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

🤖 Fixes #925. Refines the dataset comments editor tracked in #727 and the Edit menu in #875. Stacked on #908. Once #908 reaches develop, this PR can target develop.

Control rectangle differences against EEGLAB, in pixels

The dataset comments editor now follows the normalized axes used by the MATLAB figure. Its heading and editor use the reference font settings. The buttons, editing area and heading resize together. Saving and cancelling preserve the original comment text when it has not changed.

Opening window. Left to right, live MATLAB, Qt before and Qt after on the same 2560 × 1600 jamming desktop. MATLAB and the revised Qt figure both opened at 1394 × 840. The former Qt figure opened at 1394 × 456.

Opening figure

Resize. The same native figures at 950 × 620. The maximum difference in horizontal position, vertical position, width or height of the editor and buttons was 0.5 px at each size. Native toolkit painting and font rendering can still be seen in the panels. Default opening sizes on other screen configurations are outside this two-size geometry comparison.

Resized figure

SAVE and CANCEL. The two implementations displayed the same 24 lines after removal of MATLAB character-matrix padding. Saving a two-line edit returned matching comments. Cancel returned all nine original lines, including the trailing blank line, and an empty history command.

Comment text comparisons

Four test cases failed on the previous source. After the change, the focused suite passed 47 tests and deselected three optional EEGLAB backend checks. The live public-function MATLAB oracle and Qt mouse interactions ran separately on jamming. The source checkout guard, staged pre-commit checks, Ruff and type checks passed. The change is confined to this bespoke comments figure, its tests and the corresponding user documentation.

Full inventory report for the project team. pop_comments (p. 2). 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 25s —— View job


Code review

  • Overall assessment: needs changes. The new comments figure doesn't break pop_comments itself, but it does break an existing GUI test.
  • Highest-risk area: the fixed-size layout="comments" figure in qt_comments.py, which replaces the content-sized dialog.
  • Merge recommendation: needs changes

Blocking

None.

Important

  • tests/test_guifunc_primitives.py::test_multiline_editor_grows_with_long_comments will fail (not run: test commands needed approval in this job). build_comments_figure (src/eegprep/functions/guifunc/qt_comments.py:60-65) now always resizes the dialog to spec.size, scaled to fit the screen. The test still builds pop_comments_dialog_spec with 1 line and with 100 lines and asserts short.height() < long.height(). With this change, both dialogs get the same height. The file isn't in the PR, and the 47-test focused run in the description only covered tests/test_pop_comments.py.
    Fix: delete or rewrite that test. Content-driven growth was removed on purpose to match pop_comments.m, and test_comments_figure_resizes_like_matlab already covers the remaining check that resizing the window enlarges the editor. Inline comment: [GUI] Match the resizable dataset comments figure #929 (comment)

Nits

None.

Test gaps

None. The new tests check the figure geometry at two sizes and that unchanged wrapped text is restored.

EEGLAB parity notes

None found. The editor, CANCEL and SAVE rectangles ([0 10 105 85], [0 -5 20 10], [80 -5 20 10] in the default-axes coordinates) match the pop_comments.m figure layout. The opening size and both result paths (unchanged text keeps its stored line breaks; CANCEL returns the original data and an empty command) match the description. src/eegprep/eeglab/ isn't in this checkout, so I couldn't check the strmultiline(comments, 53) reflow (whitespace collapsing, and whether a line of exactly 53 characters triggers it) against the MATLAB source. The MATLAB comparison in the PR description is the only evidence for it.

Also checked: SAVE/CANCEL return values through QtDialogRenderer.run, the pop_importdata and menu (menu_actions.py) callers, the help resource, the Sphinx docs, and AGENTS.md compliance (imports, comments, docs).

Comment on lines +60 to +65
if spec.size is not None:
available = dialog.screen().availableGeometry().size()
size = core.QSize(*spec.size)
if size.width() > available.width() or size.height() > available.height():
size.scale(available, core.Qt.AspectRatioMode.KeepAspectRatio)
dialog.resize(size)

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 (breaks an existing test): the figure now opens at spec.size whatever the content, which matches pop_comments.m. But tests/test_guifunc_primitives.py::test_multiline_editor_grows_with_long_comments (

def test_multiline_editor_grows_with_long_comments(qt_dialogs):
def build(lines):
fields = qt_dialogs.build(pop_comments_dialog_spec("Dataset", "\n".join(["event note"] * lines)))
dialog = qt_dialogs.dialogs[-1]
dialog.show()
qt_dialogs.qt.QtWidgets.QApplication.processEvents()
return dialog, fields["comments"]
short, short_edit = build(1)
long, long_edit = build(100)
assert short.height() < long.height() <= long.screen().availableGeometry().height()
assert long_edit.viewport().height() > short_edit.viewport().height()
old_height = short_edit.height()
short.resize(short.width(), short.height() + 50)
qt_dialogs.qt.QtWidgets.QApplication.processEvents()
assert short_edit.height() > old_height
) still asserts short.height() < long.height() for 1 line vs. 100 lines of comments. Both dialogs now get the same height, so that assertion fails. That file wasn't in the 47-test focused run described in the PR.

Suggested fix: the content-driven growth is gone on purpose, so delete or rewrite that test. Its last half (resizing the window enlarges the editor) is already covered by test_comments_figure_resizes_like_matlab, so deleting it is probably enough.

@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: Normalized axes layout in src/eegprep/functions/guifunc/qt_comments.py and 53 column display wrapping in src/eegprep/functions/popfunc/pop_comments.py.
  • Merge recommendation: Safe to merge.

Blocking

None.

Important

None.

Nits

None.

Test gaps

None.

EEGLAB parity notes

None. Compared qt_comments.py and pop_comments.py against functions/popfunc/pop_comments.m, functions/sigprocfunc/strmultiline.m, and functions/sigprocfunc/icadefs.m. Normalized control rectangles ([0 10 105 85], [0 -5 20 10], [80 -5 20 10] relative to default axes [0.13 0.11 0.775 0.815]), figure and button colors, Courier 10 pt editor and Helvetica bold plain text title fonts, strmultiline(..., 53) trigger and word wrapping, cancel handling, and documented preservation of original line breaks when saving without edits all align.

Checked for correctness bugs, EEGLAB parity, data structure compatibility, callers (QtDialogRenderer, inputgui, pop_importdata, menu_actions, eeglab_execmenu), documentation and help files, and AGENTS.md compliance.

Tests run in a detached worktree at 683e21e03ca5352089cab3a08fae60647ec23ebf:

  • pytest tests/test_pop_comments.py tests/test_guifunc_primitives.py: 25 passed, 4 deselected.
  • pytest tests/test_stream9_gui_importers.py -k pop_comments: 1 passed, 38 deselected.
  • pytest tests/test_gui_geometry.py tests/test_eeglab_execmenu.py tests/test_package_help.py: 151 passed, 65 skipped (Linux only geometry checks on macOS), 2 deselected.
  • QT_QPA_PLATFORM=offscreen pytest tests/test_stream11_help_errors.py: 26 passed.
  • ruff check and ruff format --check on changed Python files: passed.

@arnodelorme
arnodelorme merged commit 33c0150 into develop Dec 1, 2026
9 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_comments (Edit > About this dataset): match the resizable EEGLAB figure and its editor

1 participant