-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
Remove max brush size from increase brush size keybinding #5761
Conversation
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## main #5761 +/- ##
=======================================
Coverage 90.21% 90.21%
=======================================
Files 616 616
Lines 52154 52152 -2
=======================================
Hits 47049 47049
+ Misses 5105 5103 -2
|
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.
Looks good, two small comments:
- I can't click the number by the slider to increase it above whatever I manually
]
to achieve. Initially it's 40--you can't type a larger value.
This is because the QSlider maximum is still set to 40 here:
sld.setMaximum(40)
But here we let setting the size override maximum, so]
works:
napari/napari/_qt/layer_controls/qt_labels_controls.py
Lines 439 to 446 in ede0563
def _on_brush_size_change(self): """Receive layer model brush size change event and update the slider.""" with self.layer.events.brush_size.blocker(): value = self.layer.brush_size value = np.maximum(1, int(value)) if value > self.brushSizeSlider.maximum(): self.brushSizeSlider.setMaximum(int(value)) self.brushSizeSlider.setValue(value)
I think if we're dropping the upper bound, then the field should be free-fill with a desired size.
I think you need to change:
napari/napari/_qt/layer_controls/qt_labels_controls.py
Lines 367 to 375 in ede0563
def changeSize(self, value): | |
"""Change paint brush size. | |
Parameters | |
---------- | |
value : float | |
Size of the paint brush. | |
""" | |
self.layer.brush_size = value |
To something like:
if value > self.brushSizeSlider.maximum():
self.brushSizeSlider.setMaximum(int(value))
self.layer.brush_size = value
and 2. is for a new PR:
would be nice to have some acceleration feature for [
and ]
. the +1 -1 is awefully slow once you're you're in >100 range. Something like after some amount of holding it's +2, +3, etc?
@alisterburt As it is marked for 0.4.18 cold you finish it, or I should do this? |
I've taken a look at this - for the GUI to work I have to make some changes to |
but I don't know how long that process will take and don't want to hold up release |
PR opened at superqt pyapp-kit/superqt#172 |
I'm not sure if @tlambert03 will accept it fast. The minimum and maximum should not be updated so silently in Slider. But it is not a problem to create a subclass in napari to achieve the same result. |
@Czaki let's see how it goes over there first, @tlambert03 is fast and seems ready to merge - I'd rather fix upstream properly for this :-) |
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.
❤️
Just to update myself on this PR: things work from the keyboard, but the slider then falls out of sync, but to fix that, we need to fix superqt — but will the superqt fix then instantly fix napari or do we need concerted changes? ie, should we merge this. 😂 |
@jni almost! The slider doesn't even fall out of sync if you use the keyboard, it's just not possible to achieve the keyboard behaviour (moving past the edge of the slider) with the mouse. This is working fine it's just not perfect perfect, I vote merge this as is and follow up with slider changes in superqt - the change there is proving a little annoying and I don't know if I'll get it done |
changes require upstream changes, will follow up in later PRs
@alisterburt Great, I will take advantage of the fact that @psobolewskiPhD is busy with a transconstinental move to sneakily merge this in 😂 |
# Fixes/Closes @RobAnKo added autorepeatable key bindings and set an upper bound on the brush size equal to the default max brush size in the GUI (40px) Often we want to increase it to more than that, so this PR removes that upper bound discussed in #5753 - I don't think we need an upper bound here We could (should?) also set the range for brush size in the gui dynamically based on some heuristic involving image shape/zoom at layer creation time, at least when creating from the viewer when an image layer is selected --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Juan Nunez-Iglesias <jni@fastmail.com>
Fixes/Closes
@RobAnKo added autorepeatable key bindings and set an upper bound on the brush size equal to the default max brush size in the GUI (40px)
Often we want to increase it to more than that, so this PR removes that upper bound
discussed in #5753 - I don't think we need an upper bound here
We could (should?) also set the range for brush size in the gui dynamically based on some heuristic involving image shape/zoom at layer creation time, at least when creating from the viewer when an image layer is selected
Type of change
How has this been tested?
as there are small differences between the two Qt bindings.
Final checklist:
trans.
to make them localizable.For more information see our translations guide.