Skip to content

Commit 51af133

Browse files
committed
make practice skipable after the first block
1 parent dc06658 commit 51af133

File tree

2 files changed

+92
-49
lines changed

2 files changed

+92
-49
lines changed

tasks/AssBind/instruct.py

Lines changed: 90 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,58 +3,101 @@
33
from smile.scale import scale as s
44
from .GetResponse import GetResponse
55

6+
7+
def get_is_first(run_num):
8+
return run_num == 0
69
# present instructions
710
@Subroutine
8-
def Instruct(self, config, text_names):#, resp_keys, touch, font_size):
11+
def Instruct(self, config, text_names, run_num):#, resp_keys, touch, font_size):
12+
13+
is_first = Func(get_is_first, run_num).result
914

1015
texts = get_text(config)
11-
with Parallel():
12-
if not config.TOUCH:
13-
MouseCursor(blocking=False)
14-
with Serial(blocking=False):
15-
for doc in text_names:
16-
with Parallel():
17-
title = Label(text='Memory Task Instructions',
18-
font_size=s(config.INST_TITLE_FONT_SIZE),
16+
with If(is_first):
17+
with Parallel():
18+
if not config.TOUCH:
19+
MouseCursor(blocking=False)
20+
with Serial(blocking=True):
21+
for doc in text_names:
22+
with Parallel():
23+
title = Label(text='Memory Task Instructions',
24+
font_size=s(config.INST_TITLE_FONT_SIZE),
25+
text_size=(s(config.TEXT_SIZE_WIDTH), None),
26+
top=self.exp.screen.center_y + s(415))
27+
28+
# image != None for 4 example slides
29+
with If(texts[doc]['image'] != None):
30+
image = Image(source=texts[doc]['image'],
31+
top=(title.bottom - s(10)),
32+
width=s(config.INST_IMG_WIDTH),
33+
height=s(config.INST_IMG_HEIGHT),
34+
allow_stretch=True, keep_ratio=False)
35+
with If(texts[doc]['image'] != None):
36+
Label(text=texts[doc]['text'],
37+
font_size=s(config.INST_FONT_SIZE),
38+
text_size=(s(config.TEXT_SIZE_WIDTH), None),
39+
top=(image.bottom - s(10)))
40+
41+
# image == None for first and last slides (instructions and reminder)
42+
with If(texts[doc]['image'] == None):
43+
Label(text=texts[doc]['text'],
44+
text_size=(s(config.TEXT_SIZE_WIDTH), None),
45+
font_size=s(config.INST_FONT_SIZE),
46+
top=(title.bottom - s(10)))
47+
48+
with UntilDone():
49+
Wait(1.0)
50+
GetResponse(keys=texts[doc]['keys'])
51+
52+
with Else():
53+
with Parallel():
54+
if not config.TOUCH:
55+
MouseCursor(blocking=False)
56+
with Serial(blocking=False):
57+
for doc in text_names:
58+
with Parallel():
59+
title = Label(text='Memory Task Instructions',
60+
font_size=s(config.INST_TITLE_FONT_SIZE),
61+
text_size=(s(config.TEXT_SIZE_WIDTH), None),
62+
top=self.exp.screen.center_y + s(415))
63+
64+
# image != None for 4 example slides
65+
with If(texts[doc]['image'] != None):
66+
image = Image(source=texts[doc]['image'],
67+
top=(title.bottom - s(10)),
68+
width=s(config.INST_IMG_WIDTH),
69+
height=s(config.INST_IMG_HEIGHT),
70+
allow_stretch=True, keep_ratio=False)
71+
with If(texts[doc]['image'] != None):
72+
Label(text=texts[doc]['text'],
73+
font_size=s(config.INST_FONT_SIZE),
74+
text_size=(s(config.TEXT_SIZE_WIDTH), None),
75+
top=(image.bottom - s(10)))
76+
77+
# image == None for first and last slides (instructions and reminder)
78+
with If(texts[doc]['image'] == None):
79+
Label(text=texts[doc]['text'] + '\n\nYou may press the button in the'
80+
' lower right corner to skip the practice',
1981
text_size=(s(config.TEXT_SIZE_WIDTH), None),
20-
top=self.exp.screen.center_y + s(415))
21-
22-
# image != None for 4 example slides
23-
with If(texts[doc]['image'] != None):
24-
image = Image(source=texts[doc]['image'],
25-
top=(title.bottom - s(10)),
26-
width=s(config.INST_IMG_WIDTH),
27-
height=s(config.INST_IMG_HEIGHT),
28-
allow_stretch=True, keep_ratio=False)
29-
with If(texts[doc]['image'] != None):
30-
Label(text=texts[doc]['text'],
31-
font_size=s(config.INST_FONT_SIZE),
32-
text_size=(s(config.TEXT_SIZE_WIDTH), None),
33-
top=(image.bottom - s(10)))
34-
35-
# image == None for first and last slides (instructions and reminder)
36-
with If(texts[doc]['image'] == None):
37-
Label(text=texts[doc]['text'],
38-
text_size=(s(config.TEXT_SIZE_WIDTH), None),
39-
font_size=s(config.INST_FONT_SIZE),
40-
top=(title.bottom - s(10)))
41-
42-
with UntilDone():
43-
Wait(1.0)
44-
GetResponse(keys=texts[doc]['keys'])
45-
46-
#RstDocument(text=texts[doc]['text'],
47-
#width=self.exp.screen.height,
48-
#height=self.exp.screen.height,
49-
#base_font_size=s(config.RST_FONT_SIZE))
50-
51-
52-
with Serial(blocking=False):
53-
with ButtonPress():
54-
Button(text="Skip Practice", right=self.exp.screen.width,
55-
bottom=0, width=s(config.SKIP_SIZE[0]),
56-
height=s(config.SKIP_SIZE[1]), blocking=False,
57-
font_size=s(config.SKIP_FONT_SIZE))
82+
font_size=s(config.INST_FONT_SIZE),
83+
top=(title.bottom - s(10)))
84+
85+
with UntilDone():
86+
Wait(1.0)
87+
GetResponse(keys=texts[doc]['keys'])
88+
89+
#RstDocument(text=texts[doc]['text'],
90+
#width=self.exp.screen.height,
91+
#height=self.exp.screen.height,
92+
#base_font_size=s(config.RST_FONT_SIZE))
93+
94+
with Serial(blocking=False):
95+
with ButtonPress():
96+
Button(text="Skip Practice", right=self.exp.screen.width,
97+
bottom=0, width=s(config.SKIP_SIZE[0]),
98+
height=s(config.SKIP_SIZE[1]), blocking=False,
99+
font_size=s(config.SKIP_FONT_SIZE))
100+
58101
Wait(2.0)
59102

60103

tasks/AssBind/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ def AssBindExp(self, config, sub_dir, task_dir=None, block=0,
7171
text_names = ['main', 'ex1', 'ex2', 'ex3', 'ex4', 'remind']
7272
rem_names = ['remind']
7373
with If(reminder_only):
74-
Instruct(config=config, text_names=rem_names)
74+
Instruct(config=config, text_names=rem_names, run_num=block)
7575
with Else():
76-
Instruct(config=config, text_names=text_names)
76+
Instruct(config=config, text_names=text_names, run_num=block)
7777

7878
Wait(1.0)
7979

0 commit comments

Comments
 (0)