Skip to content

Mapped slider - #361

Closed
bnorthan wants to merge 5 commits into
pyapp-kit:mainfrom
bnorthan:mapped-slider
Closed

bnorthan wants to merge 5 commits into
pyapp-kit:mainfrom
bnorthan:mapped-slider

Conversation

@bnorthan

@bnorthan bnorthan commented Oct 19, 2026 •

Copy link
Copy Markdown

While discussing this issue napari/napari#8241 it was suggested that it would be useful to add a mapped slider so that we can have finer control of the attenutaiton parameter for amip. There are two modes. In log mode each decade gives the same space on the slider but it doesn't handle min=0. In power mode the min can be 0.

The original implementation was done by @TimMonko as part of a pull request for Napari.

AI Disclaimer: The code was largely generated by pointing Claude at Tim's prototype and requesting Claude clean it up, handle min=0 better, move it here, and make it consistent with the superqt style guide.

to test

uv run examples/mapped_slider.py

to test in the context of napari/napari#8241

uv run https://gist.githubusercontent.com/bnorthan/67153ec1bd1e1f3c0e817319dfc05268/raw/amip_napari_demo.py

bnorthan and others added 5 commits October 18, 2026 05:38
QLabeledMappedSlider extends QLabeledDoubleSlider so that the slider
position is mapped to the value using a log or power curve. "log" gives
each decade the same space on the slider. "power" can start at 0 and
gives finer control near the minimum.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Constructor overloads like the other sliders, with mapping and exponent
set by setMapping and setExponent. camelCase private methods, and typing
fixes for mypy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Oct 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.48936% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.17%. Comparing base (4668c07) to head (cdf6630).

Files with missing lines Patch % Lines
src/superqt/sliders/_mapped.py 91.39% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #361      +/-   ##
==========================================
+ Coverage   84.92%   85.17%   +0.25%     
==========================================
  Files          49       50       +1     
  Lines        3940     4034      +94     
==========================================
+ Hits         3346     3436      +90     
- Misses        594      598       +4     

☔ View full report in Codecov by Harness.
📢 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.

@bnorthan
bnorthan marked this pull request as draft October 21, 2026 19:39
@bnorthan bnorthan closed this Oct 22, 2026
@tlambert03

Copy link
Copy Markdown
Member

Hey @bnorthan.
Sorry for the delay, are you closing because you/napari/etc no longer want this feature?

@bnorthan

Copy link
Copy Markdown
Author

We still want this feature. I'll probably re-open this in a few days. I closed it because we are still discussing our AI policy and how to open up pull requests to the sibling repos in the AI age.

It looks like you already have some Claude co-commits so I assume some level of agentic assistance is okay in superqt.

I rushed a bit opening this and we want to do due diligence making sure we give enough context and evidence of testing when opening AI assisted PRs.

@tlambert03

Copy link
Copy Markdown
Member

Sibling repos... of napari?

I definitely don't mind AI driven PRs. They are actually more and more often equal or higher quality. For me, the onus is on the reviewer/merger, not the contributor. (And certainly, reviewers/repos are justified in having policies that they don't accept AI PRs, but I don't mind them if they are short)

So, feel free to just leave it open and I'll have a look soon. But if you'd prefer to tune it manually go for it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants