callback from save thread

def save_callback(operation, graphdef):
    '''callback from save thread'''
    if operation == 'test':
        for e in graphdef.expressions:
            if expression_ok(e):
                graphdef.expression = e
                display_graph(graphdef)
                return
        mestate.console.writeln('Invalid graph expressions', fg='red')
        return
    if operation == 'save':
        save_graph(graphdef)