Example #1
0
File: ui.py Project: Alligator/evo
def update_on_cr(input):
    global midifocus
    global dnafocus
    if input in ('q', 'Q'):
        raise urwid.ExitMainLoop()
    if input in ('j', 'J'):
        generation.step()
        update()
        pass
    if input in ('r', 'R'):
        restart()
    if input in ('m', 'M'):
        #midi
        midifocus = True
        edit.set_caption('Enter the piece ID: ')
        leftframe.set_focus('footer')
    if input in ('e', 'E'):
        #dna
        dnafocus = True
        edit.set_caption('Enter the piece ID: ')
        leftframe.set_focus('footer')
    if input == 'enter':
        if midifocus:
            piece = edit.get_edit_text()
            try:
                utils.convertToMIDI(generation.get()[int(piece)])
                edit.set_caption('Success')
            except Exception as e:
                edit.set_caption('Invalid ID: ' + str(e))
            edit.set_edit_text('')
            leftframe.set_focus('body')
        if dnafocus:
            piece = edit.get_edit_text
            #utils.convertToMIDI(generation.get()[int(piece)])
            edit.set_caption('Success')
            edit.set_edit_text('')
            leftframe.set_focus('body')
Example #2
0
def step():
    generation.step()