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

Method __init__

brainworkshop.py:2352–2377  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2350
2351class SoundSelect(Menu):
2352 def __init__(self):
2353 audiosets = resourcepaths['sounds'] # we don't want to delete 'operations' from resourcepaths['sounds']
2354 self.new_sets = {}
2355 for audio in audiosets:
2356 if not audio == 'operations':
2357 self.new_sets['1'+audio] = audio in cfg.AUDIO1_SETS
2358 self.new_sets['2'+audio] = audio in cfg.AUDIO2_SETS
2359 for audio in audiosets:
2360 if not audio == 'operations':
2361 self.new_sets['2'+audio] = audio in cfg.AUDIO2_SETS
2362 options = list(self.new_sets)
2363 options.sort()
2364 options.insert(len(self.new_sets)//2, "Blank line") # Menu.update_labels and .select will ignore this
2365 options.append("Blank line")
2366 options.extend(['cfg.CHANNEL_AUDIO1', 'cfg.CHANNEL_AUDIO2'])
2367 lcr = ['left', 'right', 'center']
2368 vals = self.new_sets
2369 vals['cfg.CHANNEL_AUDIO1'] = Cycler(lcr, default=lcr.index(cfg.CHANNEL_AUDIO1))
2370 vals['cfg.CHANNEL_AUDIO2'] = Cycler(lcr, default=lcr.index(cfg.CHANNEL_AUDIO2))
2371 names = {}
2372 for op in options:
2373 if op.startswith('1') or op.startswith('2'):
2374 names[op] = _("Use sound set '%s' for channel %s") % (op[1:], op[0])
2375 elif 'CHANNEL_AUDIO' in op:
2376 names[op] = 'Channel %i is' % (op[-1]=='2' and 2 or 1)
2377 Menu.__init__(self, options, vals, {}, names, title=_('Choose sound sets to Sound n-back tasks.'))
2378
2379 def close(self):
2380 cfg.AUDIO1_SETS = []

Callers

nothing calls this directly

Calls 2

CyclerClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected