MCPcopy Create free account
hub / github.com/brain-workshop/brainworkshop / __init__

Method __init__

brainworkshop.py:2170–2210  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2168
2169class GameSelect(Menu):
2170 def __init__(self):
2171 modalities = ['position1', 'color', 'image', 'audio', 'audio2', 'arithmetic']
2172 options = modalities[:]
2173 names = dict([(m, _("Use %s") % m) for m in modalities])
2174 names['position1'] = _("Use position")
2175 options.extend(["Blank line", 'combination', "Blank line", 'variable',
2176 'crab', "Blank line", 'multi', 'multimode', 'Blank line',
2177 'selfpaced', "Blank line", 'interference'])
2178 names['combination'] = _('Combination N-back mode')
2179 names['variable'] = _('Use variable N-Back levels')
2180 names['crab'] = _('Crab-back mode (reverse order of sets of N stimuli)')
2181 names['multi'] = _('Simultaneous visual stimuli')
2182 names['multimode'] = _('Simultaneous stimuli differentiated by')
2183 names['selfpaced'] = _('Self-paced mode')
2184 names['interference'] = _('Interference (tricky stimulus generation)')
2185 vals = dict([[op, None] for op in options])
2186 curmodes = mode.modalities[mode.mode]
2187 interference_options = [i / 8. for i in range(0, 9)]
2188 if not cfg.DEFAULT_CHANCE_OF_INTERFERENCE in interference_options:
2189 interference_options.append(cfg.DEFAULT_CHANCE_OF_INTERFERENCE)
2190 interference_options.sort()
2191 if cfg.CHANCE_OF_INTERFERENCE in interference_options:
2192 interference_default = interference_options.index(cfg.CHANCE_OF_INTERFERENCE)
2193 else:
2194 interference_default = 3
2195 vals['interference'] = PercentCycler(values=interference_options, default=interference_default)
2196 vals['combination'] = 'visvis' in curmodes
2197 vals['variable'] = bool(cfg.VARIABLE_NBACK)
2198 vals['crab'] = bool(mode.flags[mode.mode]['crab'])
2199 vals['multi'] = Cycler(values=[1,2,3,4], default=mode.flags[mode.mode]['multi']-1)
2200 vals['multimode'] = Cycler(values=['color', 'image'], default=cfg.MULTI_MODE)
2201 vals['selfpaced'] = bool(mode.flags[mode.mode]['selfpaced'])
2202 for m in modalities:
2203 vals[m] = m in curmodes
2204 Menu.__init__(self, options, vals, names=names, title=_('Choose your game mode'))
2205 self.modelabel = pyglet.text.Label('', font_size=self.titlesize,
2206 bold=False, color=(0,0,0,255), batch=self.batch,
2207 x=width_center(), y=(window.height*1)/10,
2208 anchor_x='center', anchor_y='center')
2209 self.update_labels()
2210 self.newmode = mode.mode # self.newmode will be False if an invalid mode is chosen
2211
2212 def update_labels(self):
2213 self.calc_mode()

Callers

nothing calls this directly

Calls 5

update_labelsMethod · 0.95
PercentCyclerClass · 0.85
CyclerClass · 0.85
width_centerFunction · 0.85
__init__Method · 0.45

Tested by

no test coverage detected