Skip to content

Commit 9869f4c

Browse files
committed
fix practice skip
1 parent 54e72a7 commit 9869f4c

File tree

1 file changed

+90
-92
lines changed

1 file changed

+90
-92
lines changed

tasks/BARTUVA/instruct.py

Lines changed: 90 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def Instruct(self, config, run_num, sub_dir, task_dir=None,
3636
cont_key_str = str(config.CONT_KEY[0])
3737

3838
practice_inst = Func(get_practice_inst, config, run_num).result
39-
4039
if config.TOUCH:
4140
with Loop(computer_list) as instruction:
4241
txt = instruction.current
@@ -165,103 +164,102 @@ def Instruct(self, config, run_num, sub_dir, task_dir=None,
165164
GetResponse(keys=config.CONT_KEY)
166165

167166
with Else():
168-
with If(is_first):
169-
with Parallel():
170-
MouseCursor(blocking=False)
171-
with Serial(blocking=False):
172-
with If(full_instructions):
173-
with Loop(computer_list) as instruction:
174-
txt = instruction.current
175-
with Parallel():
176-
with If((instruction.i == 2)):
177-
with Parallel():
178-
img2 = Image(source=config.INST2_IMG_PATH,
179-
bottom=(self.exp.screen.height / 2.) + s(50),
180-
keep_ratio=True, allow_stretch=True,
181-
height=s(400))
182-
lbl2 = Label(text=txt % (config.KEY_TEXT[0],
183-
config.KEY_TEXT[-1]),
184-
halign='left', top=img2.bottom - s(10),
185-
font_size=s(config.LABEL_FONT_SIZE))
186-
Label(text='Press %s to continue' % (config.CONT_KEY_STR),
187-
halign='left',
188-
top=lbl2.bottom,
189-
font_size=s(config.LABEL_FONT_SIZE))
190-
with Else():
191-
with Parallel():
192-
lbl1 = Label(text=txt,
193-
halign='left',
194-
font_size=s(config.LABEL_FONT_SIZE))
195-
Label(text='Press %s to continue' % (config.CONT_KEY_STR),
196-
halign='left',
197-
top=lbl1.bottom - s(75),
198-
font_size=s(config.LABEL_FONT_SIZE))
199-
with UntilDone():
200-
Wait(.5)
201-
GetResponse(keys=config.CONT_KEY)
202-
203-
with If(practice):
204-
Label(text=practice_inst,
205-
halign='center',
206-
font_size=s(config.LABEL_FONT_SIZE))
167+
with Parallel():
168+
MouseCursor(blocking=False)
169+
with Serial(blocking=False):
170+
with If(full_instructions):
171+
with Loop(computer_list) as instruction:
172+
txt = instruction.current
173+
with Parallel():
174+
with If((instruction.i == 2)):
175+
with Parallel():
176+
img2 = Image(source=config.INST2_IMG_PATH,
177+
bottom=(self.exp.screen.height / 2.) + s(50),
178+
keep_ratio=True, allow_stretch=True,
179+
height=s(400))
180+
lbl2 = Label(text=txt % (config.KEY_TEXT[0],
181+
config.KEY_TEXT[-1]),
182+
halign='left', top=img2.bottom - s(10),
183+
font_size=s(config.LABEL_FONT_SIZE))
184+
Label(text='Press %s to continue' % (config.CONT_KEY_STR),
185+
halign='left',
186+
top=lbl2.bottom,
187+
font_size=s(config.LABEL_FONT_SIZE))
188+
with Else():
189+
with Parallel():
190+
lbl1 = Label(text=txt,
191+
halign='left',
192+
font_size=s(config.LABEL_FONT_SIZE))
193+
Label(text='Press %s to continue' % (config.CONT_KEY_STR),
194+
halign='left',
195+
top=lbl1.bottom - s(75),
196+
font_size=s(config.LABEL_FONT_SIZE))
207197
with UntilDone():
208198
Wait(.5)
209199
GetResponse(keys=config.CONT_KEY)
210200

211-
number_of_sets = 1
212-
self.set_number = 0
213-
self.grand_total = config.GRAND_TOTAL
214-
self.balloon_number_session = 0
215-
self.trkp_press_time = None
201+
with If(practice):
202+
Label(text=practice_inst,
203+
halign='center',
204+
font_size=s(config.LABEL_FONT_SIZE))
205+
with UntilDone():
206+
Wait(.5)
207+
GetResponse(keys=config.CONT_KEY)
216208

217-
Wait(1.)
218-
# Loop over practice blocks
219-
with Loop(number_of_sets):
220-
Wait(.5, jitter=.5)
209+
number_of_sets = 1
210+
self.set_number = 0
211+
self.grand_total = config.GRAND_TOTAL
212+
self.balloon_number_session = 0
213+
self.trkp_press_time = None
221214

222-
# Calling listgen as 'bags'
223-
bg = Func(add_air,
224-
total_number_of_balloons=len(config.PRACTICE_SETUP) * 2,
225-
num_ranges=len(config.PRACTICE_SETUP),
226-
balloon_setup=config.PRACTICE_SETUP,
227-
randomize=config.RANDOMIZE_BALLOON_NUM,
228-
reward_low=config.REWARD_LOW,
229-
reward_high=config.REWARD_HIGH,
230-
subject_directory=sub_dir,
231-
practice=True,
232-
shuffle_bags=config.SHUFFLE_BAGS)
233-
bags = bg.result
234-
self.block_tic = 0
215+
Wait(1.)
216+
# Loop over practice blocks
217+
with Loop(number_of_sets):
218+
Wait(.5, jitter=.5)
235219

236-
# with Loop(bag.current) as balloon:
237-
with Loop(bags) as balloon:
238-
Balloon = BARTSub(config,
239-
log_name='bart_practice',
240-
balloon=balloon.current,
241-
block=self.block_tic,
242-
set_number=self.set_number,
243-
grand_total=self.grand_total,
244-
balloon_number_session=self.balloon_number_session,
245-
subject=self._exp.subject,
246-
run_num=run_num,
247-
trkp_press_time=self.trkp_press_time)
248-
self.balloon_number_session += 1
249-
self.grand_total = Balloon.grand_total
250-
self.block_tic += 1
220+
# Calling listgen as 'bags'
221+
bg = Func(add_air,
222+
total_number_of_balloons=len(config.PRACTICE_SETUP) * 2,
223+
num_ranges=len(config.PRACTICE_SETUP),
224+
balloon_setup=config.PRACTICE_SETUP,
225+
randomize=config.RANDOMIZE_BALLOON_NUM,
226+
reward_low=config.REWARD_LOW,
227+
reward_high=config.REWARD_HIGH,
228+
subject_directory=sub_dir,
229+
practice=True,
230+
shuffle_bags=config.SHUFFLE_BAGS)
231+
bags = bg.result
232+
self.block_tic = 0
233+
234+
# with Loop(bag.current) as balloon:
235+
with Loop(bags) as balloon:
236+
Balloon = BARTSub(config,
237+
log_name='bart_practice',
238+
balloon=balloon.current,
239+
block=self.block_tic,
240+
set_number=self.set_number,
241+
grand_total=self.grand_total,
242+
balloon_number_session=self.balloon_number_session,
243+
subject=self._exp.subject,
244+
run_num=run_num,
245+
trkp_press_time=self.trkp_press_time)
246+
self.balloon_number_session += 1
247+
self.grand_total = Balloon.grand_total
248+
self.block_tic += 1
251249

252-
self.set_number += 1
250+
self.set_number += 1
253251

254-
Wait(.5)
255-
Label(text='You have completed the practice.\n' +
256-
'Press %s to continue.' % (cont_key_str),
257-
halign='center',
258-
font_size=s(config.LABEL_FONT_SIZE))
259-
with UntilDone():
260-
Wait(0.5)
261-
GetResponse(keys=config.CONT_KEY)
262-
with Serial(blocking=False):
263-
with ButtonPress():
264-
Button(text="Skip Practice", width=s(config.SKIP_SIZE[0]),
265-
bottom=0, right=self.exp.screen.width,
266-
height=s(config.SKIP_SIZE[1]),
267-
font_size=s(config.SKIP_FONT_SIZE))
252+
Wait(.5)
253+
Label(text='You have completed the practice.\n' +
254+
'Press %s to continue.' % (cont_key_str),
255+
halign='center',
256+
font_size=s(config.LABEL_FONT_SIZE))
257+
with UntilDone():
258+
Wait(0.5)
259+
GetResponse(keys=config.CONT_KEY)
260+
with Serial(blocking=False):
261+
with ButtonPress():
262+
Button(text="Skip Practice", width=s(config.SKIP_SIZE[0]),
263+
bottom=0, right=self.exp.screen.width,
264+
height=s(config.SKIP_SIZE[1]),
265+
font_size=s(config.SKIP_FONT_SIZE))

0 commit comments

Comments
 (0)