@@ -16,36 +16,34 @@ def HappyQuest(self, config, task, block_num, trial_num):
1616 Label (text = 'Press Spacebar to lock-in your response.' ,
1717 top = sld .bottom - s (250 ), font_size = s (config .HAPPY_FONT_SIZE ))
1818
19- with UntilDone ():
20- self .happy_start_time = Ref (clock .now )
21- self .last_check = self .happy_start_time
22- self .happy_dur = 0.0
23- self .HAPPY_SPEED = config .HAPPY_INC_BASE
24- self .first_press_time = None
25- with Loop ():
26- ans = KeyPress (keys = config .RESP_HAPPY )
27- with If (self .first_press_time == None ):
28- self .first_press_time = ans .press_time
29- with If (ans .press_time ['time' ] - self .last_check <
30- config .NON_PRESS_INT ):
31- self .HAPPY_SPEED = (config .HAPPY_INC_BASE * (Ref (clock .now ) -
32- self .happy_start_time ) * config .HAPPY_MOD ) + config .HAPPY_INC_START
33-
19+ with UntilDone ():
20+ self .happy_start_time = Ref (clock .now )
21+ self .last_check = self .happy_start_time
22+ self .happy_dur = 0.0
23+ self .HAPPY_SPEED = config .HAPPY_INC_BASE
24+ self .first_press_time = None
25+ with Loop ():
26+ ans = KeyPress (keys = config .RESP_HAPPY )
27+ with If (self .first_press_time == None ):
28+ self .first_press_time = ans .press_time
29+ with If (ans .press_time ['time' ] - self .last_check <
30+ config .NON_PRESS_INT ):
31+ self .HAPPY_SPEED = (config .HAPPY_INC_BASE * (Ref (clock .now ) -
32+ self .happy_start_time ) * config .HAPPY_MOD ) + config .HAPPY_INC_START
33+ with Else ():
34+ self .HAPPY_SPEED = config .HAPPY_INC_START
35+ self .happy_start_time = Ref (clock .now )
36+ self .last_check = Ref (clock .now )
37+ with If (ans .pressed == config .RESP_HAPPY [0 ]):
38+ with If (sld .value - self .HAPPY_SPEED <= (- 1 * config .HAPPY_RANGE )):
39+ UpdateWidget (sld , value = (- 1 * config .HAPPY_RANGE ))
3440 with Else ():
35- self .HAPPY_SPEED = config .HAPPY_INC_START
36- self .happy_start_time = Ref (clock .now )
37- self .last_check = Ref (clock .now )
38-
39- with If (ans .pressed == config .RESP_HAPPY [0 ]):
40- with If (sld .value - self .HAPPY_SPEED <= (- 1 * config .HAPPY_RANGE )):
41- UpdateWidget (sld , value = (- 1 * config .HAPPY_RANGE ))
42- with Else ():
43- UpdateWidget (sld , value = sld .value - self .HAPPY_SPEED )
44- with Elif (ans .pressed == config .RESP_HAPPY [1 ]):
45- with If (sld .value + self .HAPPY_SPEED >= config .HAPPY_RANGE ):
46- UpdateWidget (sld , value = config .HAPPY_RANGE )
47- with Else ():
48- UpdateWidget (sld , value = sld .value + self .HAPPY_SPEED )
41+ UpdateWidget (sld , value = sld .value - self .HAPPY_SPEED )
42+ with Elif (ans .pressed == config .RESP_HAPPY [1 ]):
43+ with If (sld .value + self .HAPPY_SPEED >= config .HAPPY_RANGE ):
44+ UpdateWidget (sld , value = config .HAPPY_RANGE )
45+ with Else ():
46+ UpdateWidget (sld , value = sld .value + self .HAPPY_SPEED )
4947 with UntilDone ():
5048 submit = KeyPress (keys = ['SPACEBAR' ])
5149 Log (name = "happy" ,
0 commit comments