Repository navigation
[GUI] Keep pop_importevent dialog open on import errors - #801
Conversation
Validate the import before closing the dialog so an invalid field name such as "Latency Type Position" shows a warning and keeps the file and settings available for correction. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 @claude[bot]'s task in 1m 2s —— View job Code review
BlockingNone. ImportantNone. Nits
Test gapsNone. The new offscreen test covers the regression end to end: it checks that the file and skipline survive the error, that EEGLAB parity notesNone. EEGLAB's Checked for correctness bugs, EEGLAB parity, data structure compatibility, changed-behavior tests, and CLAUDE.md/AGENTS.md compliance. |
| def _validate_dialog_values(EEG: dict[str, Any], values: dict[str, Any]) -> None: | ||
| options = _gui_options(values) | ||
| event_source = options.get("event") | ||
| if event_source is None: | ||
| raise ValueError("pop_importevent: select an event file") | ||
| try: | ||
| _import_event_records(event_source, EEG.get("event"), float(EEG.get("srate", 1) or 1), options) |
There was a problem hiding this comment.
Nit (performance): This validator runs the whole import, including _optimal_alignment. When the dataset already has events, the dialog defaults to align=0 with auto-adjust on, so clicking OK runs fmin twice. Each evaluation compares every new event with every existing one, and then pop_importevent repeats the whole search after the dialog closes. With a few thousand events, the UI freezes for twice as long.
The alignment search can't raise a validation error, so the validation copy can skip it. The _validate_alignment range checks still run:
| def _validate_dialog_values(EEG: dict[str, Any], values: dict[str, Any]) -> None: | |
| options = _gui_options(values) | |
| event_source = options.get("event") | |
| if event_source is None: | |
| raise ValueError("pop_importevent: select an event file") | |
| try: | |
| _import_event_records(event_source, EEG.get("event"), float(EEG.get("srate", 1) or 1), options) | |
| def _validate_dialog_values(EEG: dict[str, Any], values: dict[str, Any]) -> None: | |
| options = _gui_options(values) | |
| options['optimalign'] = 'off' | |
| event_source = options.get("event") | |
| if event_source is None: | |
| raise ValueError("pop_importevent: select an event file") | |
| try: | |
| _import_event_records(event_source, EEG.get("event"), float(EEG.get("srate", 1) or 1), options) |
Validate the event import before the pop_importevent dialog closes, so an invalid field name such as Latency Type Position shows a warning and keeps the file and settings for correction instead of losing them. The error text now says latency and type must be lowercase and fields follow file column order. Adds an offscreen GUI regression test.
Part of #790
🤖 Generated with Claude Code