@@ -28,59 +28,69 @@ def _validate_code(exp):
2828
2929@Subroutine
3030def InputSubject (self ):
31- with Parallel ():
32- with Parallel (blocking = False ):
33- MouseCursor ()
34- recOut = Rectangle (width = s (INFO_WIDTH ) + s (20 ),
35- height = s (INFO_HEIGHT ) + s (20 ),
36- color = INFO_OUTLINE_COLOR )
37- recin = Rectangle (width = s (INFO_WIDTH ),
38- height = s (INFO_HEIGHT ),
39- color = INFO_COLOR )
40- lbl = Label (text = CogBatt_config .EXP_NAME , center_x = recin .center_x ,
41- top = recin .top - s (10 ),
42- font_size = s (INFO_FONT_SIZE ))
43- idIn = TextInput (width = s (TEXT_INPUT_WIDTH ),
44- height = s (TEXT_INPUT_HEIGHT ),
45- font_size = s (INFO_FONT_SIZE ),
46- center_x = recin .center_x ,
47- top = lbl .bottom - s (20 ),
48- multiline = False ,
49- text = "" ,
50- disabled = False ,
51- hint_text = "Prolific Worker ID" ,
52- write_tab = False )
53- codeIn = TextInput (width = s (TEXT_INPUT_WIDTH ),
54- height = s (TEXT_INPUT_HEIGHT ),
55- font_size = s (INFO_FONT_SIZE ),
56- center_x = recin .center_x ,
57- top = lbl .bottom - s (80 ),
58- multiline = False ,
59- text = "" ,
60- disabled = False ,
61- hint_text = "4 digit task code" ,
62- write_tab = False )
63- bc = Button (text = "Continue" , font_size = s (INFO_FONT_SIZE ),
64- height = s (INFO_BUTTON_HEIGHT ),
65- width = s (INFO_BUTTON_WIDTH ),
66- right = recin .right - s (20 ),
67- bottom = recin .bottom + s (20 ),
68- name = "C" ,
69- background_normal = "" ,
70- background_color = INFO_OUTLINE_COLOR ,
71- disabled = True )
72- with Serial ():
73- with While (
74- (Ref .object (codeIn .text ).__len__ () < 4 )
75- or (Ref (str , idIn .text ) == '' )
76- ):
77- Wait (0.1 )
78- bc .disabled = False
31+ with Serial ():
32+ # Present initial CogBatt instructions.
33+ Label (text = "Welcome to the Mood and Cognition Tasks!"
34+ "\n \n You may press 'Shift' + 'Esc' to exit at any time. "
35+ "Though your progress will only be saved at the end of each task."
36+ "\n \n Press any button to continue." ,
37+ font_size = s (CogBatt_config .INST_FONT ),
38+ text_size = (s (700 ), None ))
39+ with UntilDone ():
40+ KeyPress ()
41+ with Parallel ():
42+ with Parallel (blocking = False ):
43+ MouseCursor ()
44+ recOut = Rectangle (width = s (INFO_WIDTH ) + s (20 ),
45+ height = s (INFO_HEIGHT ) + s (20 ),
46+ color = INFO_OUTLINE_COLOR )
47+ recin = Rectangle (width = s (INFO_WIDTH ),
48+ height = s (INFO_HEIGHT ),
49+ color = INFO_COLOR )
50+ lbl = Label (text = "Mood and Cognition Tasks" , center_x = recin .center_x ,
51+ top = recin .top - s (10 ),
52+ font_size = s (INFO_FONT_SIZE ))
53+ idIn = TextInput (width = s (TEXT_INPUT_WIDTH ),
54+ height = s (TEXT_INPUT_HEIGHT ),
55+ font_size = s (INFO_FONT_SIZE ),
56+ center_x = recin .center_x ,
57+ top = lbl .bottom - s (20 ),
58+ multiline = False ,
59+ text = "" ,
60+ disabled = False ,
61+ hint_text = "Prolific Worker ID" ,
62+ write_tab = False )
63+ codeIn = TextInput (width = s (TEXT_INPUT_WIDTH ),
64+ height = s (TEXT_INPUT_HEIGHT ),
65+ font_size = s (INFO_FONT_SIZE ),
66+ center_x = recin .center_x ,
67+ top = lbl .bottom - s (80 ),
68+ multiline = False ,
69+ text = "" ,
70+ disabled = False ,
71+ hint_text = "4 digit task code" ,
72+ write_tab = False )
73+ bc = Button (text = "Continue" , font_size = s (INFO_FONT_SIZE ),
74+ height = s (INFO_BUTTON_HEIGHT ),
75+ width = s (INFO_BUTTON_WIDTH ),
76+ right = recin .right - s (20 ),
77+ bottom = recin .bottom + s (20 ),
78+ name = "C" ,
79+ background_normal = "" ,
80+ background_color = INFO_OUTLINE_COLOR ,
81+ disabled = True )
82+ with Serial ():
83+ with While (
84+ (Ref .object (codeIn .text ).__len__ () < 4 )
85+ or (Ref (str , idIn .text ) == '' )
86+ ):
87+ Wait (0.1 )
88+ bc .disabled = False
7989
80- bp = ButtonPress (buttons = [bc ])
81- with If (
82- (bp .pressed == "C" )
83- ):
84- Func (self .exp ._change_smile_subj , Ref .object (idIn .text ).lower ().strip ())
85- Func (self .exp .set_var , '_code' , Ref .object (codeIn .text ).lower ().strip ())
86- Func (_validate_code , Ref .object (self .exp ))
90+ bp = ButtonPress (buttons = [bc ])
91+ with If (
92+ (bp .pressed == "C" )
93+ ):
94+ Func (self .exp ._change_smile_subj , Ref .object (idIn .text ).lower ().strip ())
95+ Func (self .exp .set_var , '_code' , Ref .object (codeIn .text ).lower ().strip ())
96+ Func (_validate_code , Ref .object (self .exp ))
0 commit comments