Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def confirm_abort_experiment(self):
- """
- Asks for confirmation before aborting the experiment.
- Displays a confirmation screen, collects the response, and acts accordingly
- Raises a response_error upon confirmation
- """
- # Display the confirmation screen
- yc = self.my_canvas.ycenter()
- ld = 40
- self.my_canvas.clear()
- self.my_canvas.text("Really Abort experiment?", y = yc - 3 * ld)
- self.my_canvas.text("Hit 'Y' to abort, ", y = yc - 0.5 * ld)
- self.my_canvas.text("Hit any other key or wait 5s to go to setup, ", y = yc + 0.5 * ld)
- self.my_canvas.show()
- # process the response:
- try:
- key, time = self.my_keyboard.get_key(timeout = 5000)
- except:
- self.setup_cal_display()
- return
- # if confirmation, close experiment
- if key == 'y':
- raise openexp.exceptions.response_error( \
- "The experiment was aborted")
- else:
- self.setup_cal_display()
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement