Skip to content
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

Fix/animation gui #625

Merged
merged 6 commits into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,26 @@ def frame_select(self):
selected_frame_name = self._widget.frameList.currentItem().text()
selected_frame = self._recorder.get_keyframe(selected_frame_name)
if selected_frame is not None:
# check if unrecorded changes would be lost
unrecorded_changes = []
current_keyframe_goals = self._recorder.get_keyframe(self._selected_frame)["goals"]

for motor_name, text_field in self._motor_controller_text_fields.items():
# Get the angle from the textfield
angle = text_field.value()
# compare with angles in current keyframe
if not current_keyframe_goals[motor_name] == math.radians(angle):
unrecorded_changes.append(motor_name)

# warn user about unrecorded changes
if unrecorded_changes:
message = (
f"""This will discard your unrecorded changes for {", ".join(unrecorded_changes)}. Continue?"""
)
sure = QMessageBox.question(self._widget, "Sure?", message, QMessageBox.Yes | QMessageBox.No)
# Cancel the open if the user does not want to discard the changes
if sure == QMessageBox.No:
return
# Update state so we have a new selected frame
self._selected_frame = selected_frame_name

Expand Down
Loading