Conversation
Jon has asked for more precision in the angles you can use in the GUI and suggested 0.1° should be enough. Make this change. We only need to update the frontend, as the backend already supports setting the angle to a `float`. Closes #932.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #951 +/- ##
==========================================
+ Coverage 87.27% 87.28% +0.01%
==========================================
Files 69 69
Lines 3623 3627 +4
==========================================
+ Hits 3162 3166 +4
Misses 461 461 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the GUI to allow users to input and view mirror angles with 0.1° precision (issue #932), aligning the frontend with the backend’s existing float-angle support.
Changes:
- Replace integer-only angle inputs with
QDoubleSpinBoxcontrols configured for 0.1° steps and one decimal place. - Update displayed angle formatting across the GUI from whole degrees to one decimal place.
- Adjust GUI tests to reflect the new fractional-angle behaviour and formatting.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/frog/gui/stepper_motor_view.py | Switches target angle input to QDoubleSpinBox, formats position display to 0.1°, updates preset-name matching logic. |
| src/frog/gui/measure_script/sequence_widget.py | Updates “Add instruction” angle input to 0.1° precision and displays sequence angles to one decimal place. |
| src/frog/gui/measure_script/script_run_dialog.py | Updates “Moving to …” status text to show angles to one decimal place. |
| tests/gui/test_stepper_motor_view.py | Updates expectations for float angle values and 0.1° formatted display strings. |
| tests/gui/measure_script/test_sequence_widget.py | Updates GOTO angle tests to use floats and removes now-redundant manual clamping expectations. |
| tests/gui/measure_script/test_script_run_dialog.py | Updates expected angle string formatting to one decimal place. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| text = f"{moved_to:.1f}°" | ||
| if preset := next( | ||
| (k for k, v in self.angle_presets.items() if round(v) == round(moved_to)), | ||
| (k for k, v in self.angle_presets.items() if abs(v - moved_to) <= 0.05), | ||
| None, | ||
| ): | ||
| text += f" ({preset})" |
There was a problem hiding this comment.
Preset name matching can become inconsistent with the displayed angle at the rounding boundary. For example, if moved_to is 180.05, the label will display 180.1° but will still match a 180.0 preset because the tolerance check uses <= 0.05. Consider matching presets based on the same 0.1° rounding used for display (e.g. compare rounded-to-1dp values, or ensure the formatted moved_to equals the formatted preset value) so the preset name is only shown when it agrees with what the user sees.
There was a problem hiding this comment.
Hmm, it's true that users can now specify a preset to be a non-integer value since we made the positions of the hot and cold BBs configurable.
That said, I think it's probably fine if it displays this message when the position is approximately the same.
Description
Jon has asked for more precision in the angles you can use in the GUI and suggested 0.1° should be enough. Make this change.
We only need to update the frontend, as the backend already supports setting the angle to a
float.This is the thing I asked Copilot to do in our session this morn, which it seemed to manage in one pass. I've tested the GUI (I created a measure script and ran it) and it now works with fractional angles as expected. There could be some bugs lurking when we try it on real hardware, but it seems ok to me.
Closes #932.
Type of change
Key checklist
pre-commit run -a)pytest)mkdocs build -s)pyinstaller-built executable works (if relevant)Further checks