Ejemplo n.º 1
0
def delete_folder(path):
    global library    
    library.delete_folder(path)

    library = LibraryManager()
    tree = library.get_tree()
    emit('set_library_tree', tree)
Ejemplo n.º 2
0
def rename_folder(folder_data):
    global library    
    folder_path = folder_data['path']
    folder_name = folder_data['name']
    library.rename_folder(folder_path, folder_name)

    library = LibraryManager()
    tree = library.get_tree()
    emit('set_library_tree', tree)
Ejemplo n.º 3
0
def refresh_library():
    global library
    library = LibraryManager()
    tree, calcs_list = library.get_tree()

    data={
        'tree': tree,
        'calcs': calcs_list
    }

    emit('set_library_tree', data)
Ejemplo n.º 4
0
def save_to_library(data):
    global library
    path = data['path']
    node_data = data['node_data']
    overwrite = data['overwrite']

    library.save(path, node_data, overwrite)

    library = LibraryManager()
    tree = library.get_tree()
    emit('set_library_tree', tree)
Ejemplo n.º 5
0
def reset():
    global graph_root
    global library
    global init_modules
    global init_path

    # Resets module imports
    if 'init_modules' in globals():
        # remove all but initially loaded modules
        for m in sys.modules.keys():
            if m not in init_modules:
                del (sys.modules[m])

    # Resets the path
    sys.path = init_path

    # TODO: Reset declared classes and functions

    # Reset computational graph and library
    graph_root = Graph()
    library = LibraryManager()
Ejemplo n.º 6
0
    graph_root = Graph()
    emit('force_session_id', graph_root.session_id)  # Force a new session id into the UI
    load_xml(graph_root, xml)
    graph_root.xmlModel = xml

@socketio.on('save_config_file')
def save_config_file(xml):
    f = open('client_pref.json', 'w')
    f.write(xml)
    f.close()
    

# Register initial modules that should not be deleted when restarting the server
init_modules = sys.modules.keys()
init_path = deepcopy(sys.path)

graph_root = Graph()
library = LibraryManager()


def start():
    print('Started at localhost:5000. Make sure to use Chrome')
    socketio.run(app, host='localhost', port=5000)
    client_url = "https://localhost:5000"
    browser = webbrowser.get()
    browser.open_new(client_url)


if __name__ == '__main__':
    start()