@@ -8,11 +8,11 @@ def get_is_first(run_num):
88 return run_num == 0
99# present instructions
1010@Subroutine
11- def Instruct (self , config , text_names , run_num ):#, resp_keys, touch, font_size):
11+ def Instruct (self , config , text_names , run_num , flip_resp = False ):#, resp_keys, touch, font_size):
1212
1313 is_first = Func (get_is_first , run_num ).result
1414
15- texts = get_text (config )
15+ texts = get_text (config , flip_resp = flip_resp )
1616 with If (is_first ):
1717 with Parallel ():
1818 if not config .TOUCH :
@@ -116,7 +116,14 @@ def Instruct(self, config, text_names, run_num):#, resp_keys, touch, font_size):
116116
117117
118118# this function reads in the text for each instruction slide and dynamically changes it based on response keys
119- def get_text (config ):#resp_keys, touch):
119+ def get_text (config , flip_resp = False ):#resp_keys, touch):
120+ if flip_resp :
121+ resp_keys = {
122+ 'old' : config .RESP_KEYS ['new' ],
123+ 'new' : config .RESP_KEYS ['old' ],
124+ }
125+ else :
126+ resp_keys = config .RESP_KEYS
120127
121128 # dictionary containing the text for each instruction slide
122129 inst = {}
@@ -155,24 +162,48 @@ def get_text(config):#resp_keys, touch):
155162 '%s to begin. '
156163
157164 # dictionary containing image path, response keys, and text for each slide
158- texts = {'main' : {'image' : None ,
159- 'keys' : [config .RESP_KEYS ['new' ], config .RESP_KEYS ['old' ]],
160- 'text' : inst ['main' ]},
161- 'ex1' : {'image' : str (config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "beehouse.jpg" ))),
162- 'keys' : [config .RESP_KEYS ['new' ]],
163- 'text' : inst ['ex1' ]},
164- 'ex2' : {'image' : str (config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "canoejoystick.jpg" ))),
165- 'keys' : [config .RESP_KEYS ['new' ]],
166- 'text' : inst ['ex2' ]},
167- 'ex3' : {'image' : str (config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "beehouse.jpg" ))),
168- 'keys' : [config .RESP_KEYS ['old' ]],
169- 'text' : inst ['ex3' ]},
170- 'ex4' : {'image' : str (config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "beejoystick.jpg" ))),
171- 'keys' : [config .RESP_KEYS ['new' ]],
172- 'text' : inst ['ex4' ]},
173- 'remind' : {'image' : None ,
174- 'keys' : [config .RESP_KEYS ['new' ], config .RESP_KEYS ['old' ]],
175- 'text' : inst ['remind' ]}}
165+ if flip_resp :
166+ texts = {'main' : {'image' : None ,
167+ 'keys' : [resp_keys ['new' ], resp_keys ['old' ]],
168+ 'text' : inst ['main' ]},
169+ 'ex1' : {'image' : str (
170+ config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "flip_beehouse.jpg" ))),
171+ 'keys' : [resp_keys ['new' ]],
172+ 'text' : inst ['ex1' ]},
173+ 'ex2' : {'image' : str (
174+ config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "flip_canoejoystick.jpg" ))),
175+ 'keys' : [resp_keys ['new' ]],
176+ 'text' : inst ['ex2' ]},
177+ 'ex3' : {'image' : str (
178+ config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "flip_beehouse.jpg" ))),
179+ 'keys' : [resp_keys ['old' ]],
180+ 'text' : inst ['ex3' ]},
181+ 'ex4' : {'image' : str (
182+ config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "flip_beejoystick.jpg" ))),
183+ 'keys' : [resp_keys ['new' ]],
184+ 'text' : inst ['ex4' ]},
185+ 'remind' : {'image' : None ,
186+ 'keys' : [resp_keys ['new' ], resp_keys ['old' ]],
187+ 'text' : inst ['remind' ]}}
188+ else :
189+ texts = {'main' : {'image' : None ,
190+ 'keys' : [resp_keys ['new' ], resp_keys ['old' ]],
191+ 'text' : inst ['main' ]},
192+ 'ex1' : {'image' : str (config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "beehouse.jpg" ))),
193+ 'keys' : [resp_keys ['new' ]],
194+ 'text' : inst ['ex1' ]},
195+ 'ex2' : {'image' : str (config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "canoejoystick.jpg" ))),
196+ 'keys' : [resp_keys ['new' ]],
197+ 'text' : inst ['ex2' ]},
198+ 'ex3' : {'image' : str (config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "beehouse.jpg" ))),
199+ 'keys' : [resp_keys ['old' ]],
200+ 'text' : inst ['ex3' ]},
201+ 'ex4' : {'image' : str (config .resource_path (os .path .join (config .TASK_DIR , "inst" , "examples" , "beejoystick.jpg" ))),
202+ 'keys' : [resp_keys ['new' ]],
203+ 'text' : inst ['ex4' ]},
204+ 'remind' : {'image' : None ,
205+ 'keys' : [resp_keys ['new' ], resp_keys ['old' ]],
206+ 'text' : inst ['remind' ]}}
176207
177208 #texts = {'main': {'file': 'inst.rst', 'keys': [config.RESP_KEYS['new'], config.RESP_KEYS['old']]},
178209 #'ex1': {'file': 'ex1.rst', 'keys': [config.RESP_KEYS['new']]},
@@ -198,20 +229,20 @@ def get_text(config):#resp_keys, touch):
198229 "Touch the screen" )
199230
200231 else :
201- texts ['main' ]['replacements' ] = ("press the %s key" % config . RESP_KEYS ['old' ], "press %s key" % config . RESP_KEYS ['new' ],
202- "Press the %s or %s key" % (config . RESP_KEYS ['old' ], config . RESP_KEYS ['new' ]))
203- texts ['ex1' ]['replacements' ] = ("press %s," % config . RESP_KEYS ['new' ],
204- "Press the %s key" % config . RESP_KEYS ['new' ])
205- texts ['ex2' ]['replacements' ] = ("press %s," % config . RESP_KEYS ['new' ],
206- "Press the %s key" % config . RESP_KEYS ['new' ])
207- texts ['ex3' ]['replacements' ] = ("press %s," % config . RESP_KEYS ['old' ],
208- "Press the %s key" % config . RESP_KEYS ['old' ])
209- texts ['ex4' ]['replacements' ] = ("press %s," % config . RESP_KEYS ['new' ],
210- "Press the %s key" % config . RESP_KEYS ['new' ])
211- texts ['remind' ]['replacements' ] = ("press %s key" % config . RESP_KEYS ['old' ],
212- "press %s key" % config . RESP_KEYS ['new' ],
213- "Press the %s or %s key" % (config . RESP_KEYS ['old' ],
214- config . RESP_KEYS ['new' ]))
232+ texts ['main' ]['replacements' ] = ("press the %s key" % resp_keys ['old' ], "press %s key" % resp_keys ['new' ],
233+ "Press the %s or %s key" % (resp_keys ['old' ], resp_keys ['new' ]))
234+ texts ['ex1' ]['replacements' ] = ("press %s," % resp_keys ['new' ],
235+ "Press the %s key" % resp_keys ['new' ])
236+ texts ['ex2' ]['replacements' ] = ("press %s," % resp_keys ['new' ],
237+ "Press the %s key" % resp_keys ['new' ])
238+ texts ['ex3' ]['replacements' ] = ("press %s," % resp_keys ['old' ],
239+ "Press the %s key" % resp_keys ['old' ])
240+ texts ['ex4' ]['replacements' ] = ("press %s," % resp_keys ['new' ],
241+ "Press the %s key" % resp_keys ['new' ])
242+ texts ['remind' ]['replacements' ] = ("press %s key" % resp_keys ['old' ],
243+ "press %s key" % resp_keys ['new' ],
244+ "Press the %s or %s key" % (resp_keys ['old' ],
245+ resp_keys ['new' ]))
215246
216247
217248 for doc in texts :
0 commit comments