Skip to content

Commit

Permalink
BF: Only draw Form when within specified timeframe, fixes #3107
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd authored and peircej committed Sep 4, 2020
1 parent f30fa28 commit 35ad5bc
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions psychopy/experiment/components/form/__init__.py
Expand Up @@ -159,10 +159,22 @@ def writeRoutineStartCode(self, buff):
pass

def writeFrameCode(self, buff):
buff.writeIndented("%(name)s.draw()\n" % (self.params))
cond = "if "
if self.params['startVal']:
cond += "t > %(startVal)s"
if self.params['stopVal'] and self.params['startVal']:
cond += " and "
if self.params['stopVal']:
cond += "t < %(startVal)s+%(stopVal)s"
cond += ":\n"
if not self.params['stopVal'] and not self.params['startVal']:
cond = ""
buff.writeIndented((cond +
" %(name)s.draw()\n") % (self.params))

def writeFrameCodeJS(self, buff):
buff.writeIndented("%(name)s.draw();\n" % (self.params))
buff.writeIndented("if t > %(start)s and t < %(stop)s:"
" %(name)s.draw();\n" % (self.params))

def writeRoutineEndCode(self, buff):
# save data, according to row/col format
Expand Down

0 comments on commit 35ad5bc

Please sign in to comment.