-
Notifications
You must be signed in to change notification settings - Fork 14
Use buttons in toolbar #1797
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
Use buttons in toolbar #1797
Conversation
50846ba
to
d60738f
Compare
@psavery There is some additional weirdness that I have noticed while testing this branch. If you click on a point on the slider the value appears to jump around rather that jumping right to that position. In this example it jumps to the last frame and the the value that was clicked on the slider: |
In the image series toolbar replace the spinbox for multi-frame images with back/forward buttons and an input text box. Functionality should remain the same, the goal is simply to provide larger buttons that are easier to use. Signed-off-by: Brianna Major <brianna.major@kitware.com>
710eebf
to
ec6bceb
Compare
hexrdgui/image_series_toolbar.py
Outdated
self.back_button.setEnabled(self.slider.minimum() != val) | ||
self.forward_button.setEnabled(self.slider.maximum() != val) | ||
|
||
def change_frame(self, value): |
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.
def change_frame(self, value): | |
def shift_frame(self, value): |
Can you rename this so it's clear that we are shifting by the value, rather than changing to the value?
hexrdgui/image_series_toolbar.py
Outdated
self.frame.textChanged.connect( | ||
lambda i: self.slider.setSliderPosition(int(i))) |
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.
self.frame.textChanged.connect( | |
lambda i: self.slider.setSliderPosition(int(i))) | |
self.frame.editingFinished.connect(self.on_frame_edited) |
I think we should only trigger an update after the user has finished editing. Otherwise, if they type in 11
, for example, it triggers an update with every keystroke (so first loads frame 1
and then loads frame 11
).
But editingFinished
also does not supply the new text as an argument, so you'd also have to check it with self.frame.text()
.
Also, we need to do some validation for the text that the user enters. I can type in invalid text like f
and it produces an exception. Instead, we should do something like this:
try:
val = int(text)
except ValueError:
# Not a valid integer. Restore the previous value.
val = prev_val
# Clip the value to the min/max range
val = max(min_val, val)
val = min(max_val, val)
Notice also we should clip the value to the min/max range. If the user sets it to something outside of the range, force it to go back to be within the range.
This better reflects what this method does. Signed-off-by: Brianna Major <brianna.major@kitware.com>
- Confirm it is an integer - Clip to range of available frames Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
This branch also needs an okay from UDRI folks since this change would affect all user workflows (although hopefully as an improvement for all).
Feedback and remaining changes: