Skip to content

Sparshr04/dynamic loader UI v2#896

Open
Sparshr04 wants to merge 5 commits into
neuroinformatics-unit:mainfrom
Sparshr04:sparshr04/dynamic-loader-ui-v2
Open

Sparshr04/dynamic loader UI v2#896
Sparshr04 wants to merge 5 commits into
neuroinformatics-unit:mainfrom
Sparshr04:sparshr04/dynamic-loader-ui-v2

Conversation

@Sparshr04
Copy link
Copy Markdown
Contributor

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
Currently, the DataLoader widget only exposes file_path, source_software, and fps. However, the underlying software-specific loader functions (like those for Anipose, NWB, and VIA-tracks) accept additional kwargs. This PR is needed to expose those kwargs in the frontend, allowing users to fully utilize the loaders without dropping down to the Python API.

What does this PR do?
This PR implements a dynamic UI for the napari data-loader widget:

  • Adds Anipose and NWB as options in the source_software dropdown.
  • Dynamically reveals relevant input fields based on the selected software (e.g., individual_name for Anipose; processing_module and pose_estimation_key for NWB; use_file_frame_numbers and frame_regexp for VIA-tracks).
  • Disables the fps spinbox when NWB (or netCDF) is selected, as the fps is read directly from the file.
  • Implements the UI toggling using a PyQt5-compatible helper (_set_row_visible) to hide/show QFormLayout rows without relying on Qt6-exclusive methods.
  • Collects the values from the visible fields and passes them as **kwargs to the newly unified load_dataset entry point.

References

How has this PR been tested?

  • Automated Tests: Updated test_data_loader_widget.py to account for the new layout row count (rowCount() == 9). Added tests to verify the dynamic visibility logic (_on_source_software_changed) and ensure the correct kwargs are extracted and forwarded based on the selected software. All 71 tests in the suite pass locally.
  • Manual Verification: Launched napari locally, opened the plugin, and manually verified that the correct fields appear/disappear and the fps spinbox disables appropriately when cycling through the source_software options.

Is this a breaking change?

No. This strictly extends the UI capabilities. Default fallback values are provided for all new kwargs (matching the backend defaults) to ensure no existing workflows are disrupted.

Does this PR require an update to the documentation?

No major documentation updates are required. All newly added UI fields have been equipped with detailed Qt tooltips to guide the user on what each parameter does.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@sonarqubecloud
Copy link
Copy Markdown

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.

1 participant