def compute(self, cols=1, vertical=False):
text = 'Blofeld preset list:\n\n'
for b, bank in enumerate(self.main.blofeld_library.data):
if b not in self.bank_selection: continue
sounds = []
for sound in bank:
sounds.append('{}{:03}\t{}'.format(uppercase[sound.bank], sound.prog+1, sound.name))
if sounds:
text += 'Bank {}:\n=======\n'.format(uppercase[sound.bank])
if cols == 1:
text += '\n'.join(sounds)
else:
if vertical:
div = len(sounds)/cols
if div*cols < len(sounds):
div += 1
for d in range(div):
for col in range(cols):
try:
text += sounds[d + div*col]
if col == cols-1:
text += '\n'
else:
text += '\t\t'
except:
text += '\n'
break
else:
col = 0
for txt in sounds:
text += txt
col += 1
if col == cols:
text += '\n'
col = 0
else:
text += '\t\t'
text += '\n\n'
self.text = text
评论列表
文章目录