-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a logarithmic scale slider class #38
Conversation
Codecov Report
@@ Coverage Diff @@
## master #38 +/- ##
==========================================
+ Coverage 95.82% 95.98% +0.15%
==========================================
Files 14 16 +2
Lines 934 971 +37
==========================================
+ Hits 895 932 +37
Misses 39 39
Continue to review full report at Codecov.
|
Ok, something weird is going on with the tests. I can't see how the changes here could possibly have caused this, but here's what I've found.
So, what to do? If we can remove the line |
that was a pretty fragile test to begin with and was very dependent on the order of operations. Once a qtbot makes an app, it sticks around for the rest of the tests. I was asserting that there was no instance so that we could make sure that the I just pushed a fix here, which deletes any pre-existing application instance using |
Thank you for the fix! Very helpful :) |
welp... looks like pyside2 was ok with that, but not pyqt5. I just skipped the test for pyqt5. |
super().__init__(Qt.Horizontal, parent=parent) | ||
self.setMinimum(0) | ||
self.setMaximum(10) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to make this slightly more flexible, perhaps we should add an attribute self.base = math.e
... then convert math.exp(value)
to math.pow(self.base, value)
and math.log(value)
to math.log(value, base=self.base)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice touch, I like this suggestion a lot. Done!
Fix for new warnings in the tests: Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python. Co-authored-by: Talley Lambert <talley.lambert@gmail.com>
Co-authored-by: Talley Lambert <talley.lambert@gmail.com>
Co-authored-by: Talley Lambert <talley.lambert@gmail.com>
Ok I think I've addressed all the reviewer suggestions, and we have a passing test suite now (thanks to Talley). I think things are looking good here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
Juan originally suggested a log scale slider for napari (napari/napari#938) but this strikes me as something that would also be very useful to have available in
magicgui
.Adds numpy as a base requirement.
The main limitation of the log slider is that the available range is restricted from 0 -> 14.5. If you go any higher than 14.5 you get an overflow error from Qt. Qt expects internal values in the range of -2147483647 to +2147483647, so the exponential can cause problems quickly. Still, I think there is some value in having a log slider available, even if there are some restrictions here.