Skip to content

Fix sizing and scrolling of main widget and containers#123

Merged
TimMonko merged 14 commits into
napari:mainfrom
TimMonko:enh/container-layout
Mar 17, 2026
Merged

Fix sizing and scrolling of main widget and containers#123
TimMonko merged 14 commits into
napari:mainfrom
TimMonko:enh/container-layout

Conversation

@TimMonko

@TimMonko TimMonko commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

References and relevant issues

Scrolling gets a little broken and expands forever, especially in horizontal mode. Also, there was very ppor test coverage of the main widget.

Description

This works by using a "water-fill" approach to expanding individual widgets (see _allocate_section_extens(). Whereby scrollbars / shrinking will only be done on the "largest" widget, allowing smaller widgets to take up their full space (mostly done through the container's new SizeHint. It also means that there less dependence on an overall outer scrollbar, until its gets so tiny its hard to use anyways...

It also correctly maintains expansion state and doesn't do as expensive of rebuilds for the switches.

It also adds good test coverage generally for the main widget, which didn't exist before and allowed all sorts of things to break. Again, these are LLM generated tests, so I haven't looked as closely at them and they probably aren't amazing.

image image

@codecov

codecov Bot commented Mar 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.82540% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.12%. Comparing base (0b81688) to head (14fbc7a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/napari_metadata/widgets/_main.py 95.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #123      +/-   ##
==========================================
+ Coverage   93.20%   94.12%   +0.92%     
==========================================
  Files          11       11              
  Lines        1236     1379     +143     
==========================================
+ Hits         1152     1298     +146     
+ Misses         84       81       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TimMonko TimMonko marked this pull request as ready for review March 14, 2026 14:25
@TimMonko

Copy link
Copy Markdown
Contributor Author

@carlos, this is ready to go with good test coverage, but a painful review. I tested it in napari as much as possible at it seems to work. I know we discussed in morning meeting, but there is no rush for this PR because it merges cleanly (surprisingly into the events callback branch we were working on earlier)

@TimMonko

Copy link
Copy Markdown
Contributor Author

I'm going to merge this because it becomes harder to merge with #125

@TimMonko TimMonko merged commit d6b85e9 into napari:main Mar 17, 2026
19 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.

1 participant