import utils as u import pygame from itertools import cycle def draw_menu1(o): bpm_inc = 4 x_size = o.width / 4 y_size = o.height / 4 og_x = 0 o_x = og_x o_y = o.height text_padding = 6 _id = 0 while _id < 16: o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.blue) if _id == 0: o.center_block("Main", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 1: o.center_block("Note", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 2: o.center_block("Patt", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 3: o.center_block("Song", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 4: o.center_block("File", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 5: o.center_block("Util", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) # if _id == 6: # o.center_block("Bank-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) # if _id == 7: # o.center_block("Bank+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 8: o.center_block("Vol-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 9: o.center_block("Vol+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) #if _id == 11: #o.center_block("", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 12: o.center_block("Play", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 13: o.center_block("Stop", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 10: o.center_block("BPM-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 11: o.center_block("BPM+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) o_x = o_x + x_size _id += 1 if _id % 4 == 0: o_y -= y_size o_x = og_x def draw_menu2_sample(o): bpm_inc = 4 x_size = o.width / 4 y_size = o.height / 4 og_x = 0 o_x = og_x o_y = o.height text_padding = 6 _id = 0 while _id < 16: o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey) if _id == 0: o.center_block("Copy", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 1: o.center_block("Paste", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 2: o.center_block("Del", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 3: o.center_block("Load", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 4: if o.prev == True: o.center_block("Prev", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink) else: o.center_block("Prev", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 8: o.center_block("Vol-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 9: o.center_block("Vol+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 6: o.center_block("Bank-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 7: o.center_block("Bank+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 10: o.center_block("Pitch-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 11: o.center_block("Pitch+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 12: if o.odub == True: o.center_block("Odub", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink) else: o.center_block("Odub", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 13: o.center_block("Undo", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 14: if o.erase == True: o.center_block("Erase", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink) else: o.center_block("Erase", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 15: if o.mute == True: o.center_block("Mute", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink) else: o.center_block("Mute", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) o_x = o_x + x_size _id += 1 if _id % 4 == 0: o_y -= y_size o_x = og_x def draw_menu2_pattern(o): bpm_inc = 4 x_size = o.width / 4 y_size = o.height / 4 og_x = 0 o_x = og_x o_y = o.height text_padding = 6 _id = 0 while _id < 16: o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey) if _id == 0: o.center_block("Copy", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 1: o.center_block("Paste", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 2: o.center_block("Clear", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 6: o.center_block("Bank -", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 7: o.center_block("Bank +", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 12: if o.pat_odub: o.center_block("Odub", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink) else: o.center_block("Odub", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 13: if o.pat_perf: o.center_block("Perf", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink) else: o.center_block("Perf", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) o_x = o_x + x_size _id += 1 if _id % 4 == 0: o_y -= y_size o_x = og_x def draw_menu2_note(o): bpm_inc = 4 x_size = o.width / 4 y_size = o.height / 4 og_x = 0 o_x = og_x o_y = o.height text_padding = 6 _id = 0 while _id < 16: o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey) if _id == 8: o.center_block("Vol -", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) elif _id == 9: o.center_block("Vol +", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) elif _id == 12: if o.patternFollow: o.center_block("Follow", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.pink) else: o.center_block("Follow", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) o_x = o_x + x_size _id += 1 if _id % 4 == 0: o_y -= y_size o_x = og_x def draw_menu2_song(o): bpm_inc = 4 x_size = o.width / 4 y_size = o.height / 4 og_x = 0 o_x = og_x o_y = o.height text_padding = 6 _id = 0 while _id < 16: o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey) if _id == 6: o.center_block("Bank -", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 7: o.center_block("Bank +", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) o_x = o_x + x_size _id += 1 if _id % 4 == 0: o_y -= y_size o_x = og_x def draw_menu_saveas(o): bpm_inc = 4 x_size = o.width / 2 y_size = o.height / 4 og_x = 0 o_x = og_x o_y = o.height text_padding = 6 _id = 0 while _id < 8: o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.dark_grey) if _id == 6: o.center_block("Select Folder", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) if _id == 7: o.center_block("New Folder", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey) o_x = o_x + x_size _id += 1 if _id % 2 == 0: o_y -= y_size o_x = og_x def menu1_actions(self, o): if o.keyState[8] == 4 or o.keyState[8] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[9] == 4 or o.keyState[9] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[16] == 2: #print('key 8 ', o.keyState[8]) #o.button_repeater(0, [8,9,14,15]) if o.keyState[0] == 1: self.FSM.ToTransition('toMain') elif o.keyState[1] == 1: self.FSM.ToTransition('toEditSoundSequence') elif o.keyState[2] == 1: self.FSM.ToTransition('toSelectPattern') elif o.keyState[3] == 1: self.FSM.ToTransition('toEditSong') elif o.keyState[4] == 1: self.FSM.ToTransition('toFile') elif o.keyState[5] == 1: self.FSM.ToTransition('toUtil') if o.keyState[12] == 1: o.start_playback() u.play_seq(o, [o.curPattern, 0]) if o.keyState[13] == 1: o.stop_playback() if o.keyState[8] == 2: if (o.repeater_states[8] != None and ((pygame.time.get_ticks() - o.repeater_states[8]) > 500)): if o.volume > 0: o.volume -= 1 u.text_center(o, "Master Volume", str(o.volume)) o.update_display(0) o.repeater_states[8] = pygame.time.get_ticks() if o.keyState[8] == 1: o.repeater_states[8] = pygame.time.get_ticks() if o.volume > 0: o.volume -= 1 u.text_center(o, "Master Volume", str(o.volume)) o.update_display(0) if o.keyState[9] == 2: if (o.repeater_states[9] != None and ((pygame.time.get_ticks() - o.repeater_states[9]) > 500)): if o.volume < 16: o.volume += 1 u.text_center(o, "Master Volume", str(o.volume)) o.update_display(0) o.repeater_states[9] = pygame.time.get_ticks() if o.keyState[9] == 1: o.repeater_states[9] = pygame.time.get_ticks() if o.volume < 16: o.volume += 1 u.text_center(o, "Master Volume", str(o.volume)) o.update_display(0) if o.keyState[11] == 1: #o.save_song() pass if o.keyState[10] == 2: if (o.repeater_states[10] != None and ((pygame.time.get_ticks() - o.repeater_states[10]) > 500)): if o.bpm > 60: o.bpm = o.bpm - o.bpm_inc o.update_bpm() u.text_center(o, "Master BPM", str(o.bpm)) o.update_display(0) o.repeater_states[10] = pygame.time.get_ticks() if o.keyState[10] == 1: o.repeater_states[10] = pygame.time.get_ticks() if o.bpm > 60: o.bpm = o.bpm - o.bpm_inc o.update_bpm() u.text_center(o, "Master BPM", str(o.bpm)) o.update_display(0) if o.keyState[11] == 2: if (o.repeater_states[11] != None and ((pygame.time.get_ticks() - o.repeater_states[11]) > 500)): if o.bpm < 240: o.bpm = o.bpm + o.bpm_inc o.update_bpm() u.text_center(o, "Master BPM", str(o.bpm)) o.update_display(0) o.repeater_states[11] = pygame.time.get_ticks() if o.keyState[11] == 1: o.repeater_states[11] = pygame.time.get_ticks() if o.bpm < 240: o.bpm = o.bpm + o.bpm_inc o.update_bpm() u.text_center(o, "Master BPM", str(o.bpm)) o.update_display(0) def menu2_actions_sample(self, o): if o.keyState[6] == 4 or o.keyState[6] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[7] == 4 or o.keyState[7] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[8] == 4 or o.keyState[8] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[9] == 4 or o.keyState[9] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[10] == 4 or o.keyState[10] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[11] == 4 or o.keyState[11] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[17] == 2: if o.keyState[0] == 1: if o.soundSlots[o.eSound].volume > 0: #print('copy') o.soundClipboard = [o.soundSlots[o.eSound].file, o.soundSlots[o.eSound].volume, o.soundSlots[o.eSound].pitch] #print(o.soundClipboard) if o.keyState[1] == 1: if o.soundClipboard != []: #print('pasting ', o.soundClipboard) o.soundSlots[o.eSound].file = o.soundClipboard[0] o.soundSlots[o.eSound].volume = o.soundClipboard[1] o.soundSlots[o.eSound].pitch = o.soundClipboard[2] o.soundSlots[o.eSound].create_sound() o.soundSlots[o.eSound].set_pitch() if o.keyState[2] == 1: #print('delete sound ', o.eSound) o.soundSlots[o.eSound].file = None o.soundSlots[o.eSound].volume = 16 o.soundSlots[o.eSound].pitch = 0 if o.keyState[3] == 1: #print('load') o.FSM.FSM.ToTransition("toLoadSound") if o.keyState[4] == 1: o.prev = not o.prev draw_menu2_sample(o) o.update_display(0) if o.keyState[8] == 2: if (o.repeater_states[8] != None and ((pygame.time.get_ticks() - o.repeater_states[8]) > 500)): if o.soundSlots[o.eSound].volume > 0: o.soundSlots[o.eSound].volume -= 1 u.text_center(o, "Sample Volume", str(o.soundSlots[o.eSound].volume)) o.update_display(0) o.repeater_states[8] = pygame.time.get_ticks() if o.keyState[8] == 1: if o.soundSlots[o.eSound].volume > 0: o.soundSlots[o.eSound].volume -= 1 u.text_center(o, "Sample Volume", str(o.soundSlots[o.eSound].volume)) o.update_display(0) o.repeater_states[8] = pygame.time.get_ticks() if o.keyState[9] == 2: if (o.repeater_states[9] != None and ((pygame.time.get_ticks() - o.repeater_states[9]) > 500)): if o.soundSlots[o.eSound].volume < 16: o.soundSlots[o.eSound].volume += 1 u.text_center(o, "Sample Volume", str(o.soundSlots[o.eSound].volume)) o.update_display(0) o.repeater_states[9] = pygame.time.get_ticks() if o.keyState[9] == 1: if o.soundSlots[o.eSound].volume < 16: o.soundSlots[o.eSound].volume += 1 u.text_center(o, "Sample Volume", str(o.soundSlots[o.eSound].volume)) o.update_display(0) o.repeater_states[9] = pygame.time.get_ticks() if o.keyState[6] == 2: if (o.repeater_states[6] != None and ((pygame.time.get_ticks() - o.repeater_states[6]) > 500)): if o.note_bank > 0: o.note_bank -= 1 u.text_center(o, "Sound Bank", str(o.note_bank)) o.update_display(0) o.repeater_states[6] = pygame.time.get_ticks() if o.keyState[6] == 1: if o.note_bank > 0: o.note_bank -= 1 u.text_center(o, "Sound Bank", str(o.note_bank)) o.repeater_states[6] = pygame.time.get_ticks() o.update_display(0) if o.keyState[7] == 2: if (o.repeater_states[7] != None and ((pygame.time.get_ticks() - o.repeater_states[7]) > 500)): if o.note_bank < 3: o.note_bank += 1 u.text_center(o, "Sound Bank", str(o.note_bank)) o.update_display(0) o.repeater_states[7] = pygame.time.get_ticks() if o.keyState[7] == 1: if o.note_bank < 3: o.note_bank += 1 u.text_center(o, "Sound Bank", str(o.note_bank)) o.repeater_states[7] = pygame.time.get_ticks() o.update_display(0) if o.keyState[10] == 2: if (o.repeater_states[10] != None and ((pygame.time.get_ticks() - o.repeater_states[10]) > 500)): if o.soundSlots[o.eSound].pitch > -10: o.soundSlots[o.eSound].pitch -= 1 u.text_center(o, "Sample Pitch", str(o.soundSlots[o.eSound].pitch)) o.soundSlots[o.eSound].set_pitch() o.update_display(0) o.repeater_states[10] = pygame.time.get_ticks() if o.keyState[10] == 1: if o.soundSlots[o.eSound].pitch > -10: o.soundSlots[o.eSound].pitch -= 1 u.text_center(o, "Sample Pitch", str(o.soundSlots[o.eSound].pitch)) o.soundSlots[o.eSound].set_pitch() o.repeater_states[10] = pygame.time.get_ticks() o.update_display(0) if o.keyState[11] == 2: if (o.repeater_states[11] != None and ((pygame.time.get_ticks() - o.repeater_states[11]) > 500)): if o.soundSlots[o.eSound].pitch < 10: o.soundSlots[o.eSound].pitch += 1 u.text_center(o, "Sample Pitch", str(o.soundSlots[o.eSound].pitch)) o.soundSlots[o.eSound].set_pitch() o.update_display(0) o.repeater_states[11] = pygame.time.get_ticks() if o.keyState[11] == 1: if o.soundSlots[o.eSound].pitch < 10: o.soundSlots[o.eSound].pitch += 1 u.text_center(o, "Sample Pitch", str(o.soundSlots[o.eSound].pitch)) o.soundSlots[o.eSound].set_pitch() o.repeater_states[11] = pygame.time.get_ticks() o.update_display(0) if o.keyState[12] == 1: o.odub = not o.odub o.undo_buf = [] #print('odub now is ', o.odub) draw_menu2_sample(o) o.update_display(0) if o.keyState[13] == 1: #print('undo something') for i in o.undo_buf: o.soundSlots[i[0]].notes[i[1]][i[2]][0] = 0 o.soundSlots[i[0]].notes[i[1]][i[2]][1] = 0 o.undo_buf = [] if o.keyState[14] == 1: o.erase = not o.erase o.erase_buf = [] #print('erase now is ', o.erase) if o.erase: o.mute = False o.mute_buf = [] draw_menu2_sample(o) o.update_display(0) if o.keyState[15] == 1: o.mute = not o.mute o.mute_buf = [] #print('mute now is ', o.mute) if o.mute: o.erase = False o.erase_buf = [] draw_menu2_sample(o) o.update_display(0) def menu2_actions_pattern(self, o): if o.keyState[17] == 2: if o.keyState[0] == 1: print('copy') o.patternClipboard = [] for s in o.soundSlots: notes = [] for i in s.notes[o.ePattern]: notes.append([i[0], i[1]]) o.patternClipboard.append(notes) print('adding to clip ', notes) elif o.keyState[1] == 1: print('paste') if o.patternClipboard != []: p = 0 for s in o.soundSlots: n = 0 for i in s.notes[o.ePattern]: i[0] = o.patternClipboard[p][n][0] i[1] = o.patternClipboard[p][n][1] n += 1 print('added ', o.patternClipboard[p]) p += 1 else: print('nothing to paste') elif o.keyState[2] == 1: print('clear') print(o.soundSlots[o.eSound].notes[o.ePattern]) for s in o.soundSlots: for i in s.notes[o.ePattern]: i[0] = 0 i[1] = 0 elif o.keyState[6] == 1: if o.pat_bank > 0: o.pat_bank -= 1 u.text_center(o, "Pattern Bank", str(o.pat_bank)) o.update_display(0) elif o.keyState[7] == 1: if o.pat_bank < 3: o.pat_bank += 1 u.text_center(o, "Pattern Bank", str(o.pat_bank)) o.update_display(0) #-------------------------------------------- elif o.keyState[12] == 1: o.pat_odub = not o.pat_odub if o.pat_odub: if o.playing: o.stop_playback() o.song_in = [o.curPattern] if o.pat_perf: pass else: o.pat_perf = True else: o.pat_perf = False o.song = o.song_in o.pat_buf = o.song_in o.song_in = [] o.songCycle = cycle(o.song) o.songStart = o.song[0] draw_menu2_pattern(o) o.update_display(0) elif o.keyState[13] == 1: o.pat_perf = not o.pat_perf if o.pat_perf: o.pat_buf = o.song o.song = [] print('song is now ', o.song) else: o.song = o.pat_buf print('song is now ', o.song) draw_menu2_pattern(o) o.update_display(0) def menu2_actions_song(self, o): if o.keyState[17] == 2: if o.keyState[6] == 1: if o.pat_bank > 0: o.pat_bank -= 1 u.text_center(o, "Pattern Bank", str(o.pat_bank)) o.update_display(0) elif o.keyState[7] == 1: if o.pat_bank < 3: o.pat_bank += 1 u.text_center(o, "Pattern Bank", str(o.pat_bank)) o.update_display(0) def menu2_actions_note(self, o): if o.keyState[8] == 4 or o.keyState[8] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[9] == 4 or o.keyState[9] == 3: #print('reset repeat from menu') o.button_repeater(1,[]) if o.keyState[17] == 2: if o.keyState[8] == 2: if (o.repeater_states[8] != None and ((pygame.time.get_ticks() - o.repeater_states[8]) > 500)): if o.note_vol > 0: o.note_vol -= 1 u.text_center(o, "Note Volume", str(o.note_vol)) o.update_display(0) o.repeater_states[8] = pygame.time.get_ticks() if o.keyState[8] == 1: if o.note_vol > 0: o.note_vol -= 1 u.text_center(o, "Note Volume", str(o.note_vol)) o.repeater_states[8] = pygame.time.get_ticks() o.update_display(0) if o.keyState[9] == 2: if (o.repeater_states[9] != None and ((pygame.time.get_ticks() - o.repeater_states[9]) > 500)): if o.note_vol < 16: o.note_vol += 1 u.text_center(o, "Note Volume", str(o.note_vol)) o.update_display(0) o.repeater_states[9] = pygame.time.get_ticks() if o.keyState[9] == 1: if o.note_vol < 16: o.note_vol += 1 u.text_center(o, "Note Volume", str(o.note_vol)) o.repeater_states[9] = pygame.time.get_ticks() o.update_display(0) if o.keyState[12] == 1: if o.patternFollow: o.patternFollow = False else: o.patternFollow = True #print('pattern follow is ', o.patternFollow) draw_menu2_note(o) o.update_display(0) def menu2_actions_saveas(self, o): if o.keyState[17] == 2: if o.keyState[12] == 1: #print('select folder') self.FSM.ToTransition('toSelectFolder') elif o.keyState[14] == 1: #print('new folder') self.FSM.ToTransition('toNewDir') def util_command(self, o, command): if command == "Clock": self.FSM.ToTransition('toClock') elif command == "Balls": self.FSM.ToTransition('toBall') elif command == "Defender": self.FSM.ToTransition('toDefender') elif command == "Calculator": self.FSM.ToTransition('toCalculator') elif command == "Exit": self.FSM.ToTransition('toExit') elif command == "Theme": self.FSM.ToTransition('toSelTheme') elif command == "Reboot": self.FSM.ToTransition('toReboot') elif command == "Update": self.FSM.ToTransition('toUpdate') elif command == "Shutdown": self.FSM.ToTransition('toShutdown') elif command == "Ping": self.FSM.ToTransition('toPing') elif command == "Wifi": self.FSM.ToTransition('toWifi') elif command == "About": self.FSM.ToTransition('toAbout') def file_command(self, o, command): if command == "Save": if o.sconf['title'] != "blank": o.save_song() else: pass #print('cant save over blank') elif command == "Open": self.FSM.ToTransition('toOpenSong') elif command == "Save As": self.FSM.ToTransition('toEnterText') elif command == "New": o.song_dir = o.base_song_dir o.mconf['default_song'] = '_blank' o.load_song() self.FSM.ToTransition('toMain')