| 2350 | |
| 2351 | class 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 = [] |