Skip to content

Commit

Permalink
BF: when to reset the routineTimer; fixes psychopy#822
Browse files Browse the repository at this point in the history
- handles my case (nonSlip follows non-nonSlip with code for launchScan in End Routine)
- might not fix all situations?
  • Loading branch information
jeremygray committed Feb 1, 2015
1 parent 6ff5ef1 commit 01832d4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions psychopy/app/builder/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,6 @@ def writeMainCode(self,buff):
#are we done yet?
buff.writeIndentedLines('\n# check if all components have finished\n')
buff.writeIndentedLines('if not continueRoutine: # a component has requested a forced-end of Routine\n')
buff.writeIndentedLines(' routineTimer.reset() # if we abort early the non-slip timer needs reset\n')
buff.writeIndentedLines(' break\n')
buff.writeIndentedLines('continueRoutine = False # will revert to True if at least one component still running\n')
buff.writeIndentedLines('for thisComponent in %sComponents:\n' %self.name)
Expand All @@ -1242,9 +1241,6 @@ def writeMainCode(self,buff):
buff.writeIndentedLines('\n# refresh the screen\n')
buff.writeIndented("if continueRoutine: # don't flip if this routine is over or we'll get a blank screen\n")
buff.writeIndented(' win.flip()\n')
if not useNonSlip:
buff.writeIndented("else: # this Routine was not non-slip safe so reset non-slip timer\n")
buff.writeIndented(' routineTimer.reset()\n')

#that's done decrement indent to end loop
buff.setIndentLevel(-1,True)
Expand All @@ -1257,6 +1253,11 @@ def writeMainCode(self,buff):
for event in self:
event.writeRoutineEndCode(buff)

# reset routineTimer at the *very end* of all non-nonSlip routines
if not useNonSlip:
buff.writeIndented('# the Routine "%s" was not non-slip safe, so reset the non-slip timer\n' % self.name)
buff.writeIndented('routineTimer.reset()\n')

def writeExperimentEndCode(self,buff):
"""This defines the code for the frames of a single routine
"""
Expand Down

0 comments on commit 01832d4

Please sign in to comment.