Skip to content

fix: Update text after settings decimals in SliderLabel#323

Merged
tlambert03 merged 10 commits intopyapp-kit:mainfrom
TimMonko:fix/slider-decimals
Jan 27, 2026
Merged

fix: Update text after settings decimals in SliderLabel#323
tlambert03 merged 10 commits intopyapp-kit:mainfrom
TimMonko:fix/slider-decimals

Conversation

@TimMonko
Copy link
Contributor

@TimMonko TimMonko commented Jan 2, 2026

x-ref napari/napari#8534

Starting from commit 55b6639, it seems there was a disconnection in updating text.
I added a test to demonstrate the issue, which fails on main but passes with this PR

Again, like in #320, I'm not sure this is the correct fix, but my idea was this:
make setDecimals call updateText, so that also in the __init__ of SliderLabel the text gets forced to render properly, rather than just setText. But maybe there are other events or some bigger event that should be calling updateText? I didn't want to put updateText in the init for this reason, because then it would duplicate, but maybe there are other instances.

Now, setDecimals will properly update the display of the text -- which before was both uncentered and the wrong decimals

Below should be 0 decimals, but on main is not:

image

With this PR:

image

p.s. I tried to learn git rebase for these commit and seemingly screwed up 🙃

@codecov
Copy link

codecov bot commented Jan 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.40%. Comparing base (20ffc3e) to head (591cd73).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #323   +/-   ##
=======================================
  Coverage   86.40%   86.40%           
=======================================
  Files          49       49           
  Lines        3861     3861           
=======================================
  Hits         3336     3336           
  Misses        525      525           

☔ 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.

Copy link
Contributor

@Czaki Czaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, this PR looks good

@tlambert03 tlambert03 changed the title Update text after settings decimals in SliderLabel fix: Update text after settings decimals in SliderLabel Jan 27, 2026
@tlambert03 tlambert03 added the bug Something isn't working label Jan 27, 2026
@tlambert03
Copy link
Member

thanks for confirming @Czaki 👍

@tlambert03 tlambert03 merged commit 8eb941e into pyapp-kit:main Jan 27, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

3 participants