Exemplo n.º 1
0
def run(ruleset_definitions = None, databases = ['/tmp/redis.sock'], start = None):
    import engine
    import interface

    main_host = engine.Host(ruleset_definitions, databases)
    if start:
        start(main_host)

    main_app = interface.Application(main_host)
    main_app.run()
Exemplo n.º 2
0
def run_all(databases=[{'host': 'localhost', 'port': 6379, 'password': None}]):
    ruleset_definitions = {}
    for rset in _rulesets:
        ruleset_name, ruleset_definition = rset.define()
        ruleset_definitions[ruleset_name] = ruleset_definition

    main_host = engine.Host(ruleset_definitions, databases)
    for start in _start_functions:
        start(main_host)

    main_app = interface.Application(main_host)
    main_app.run()
Exemplo n.º 3
0
def run_all(databases=[{
    'host': 'localhost',
    'port': 6379,
    'password': None
}],
            host_name='127.0.0.1',
            port=5000,
            routing_rules=[],
            run=None,
            state_cache_size=1024):
    main_host = create_host(databases, state_cache_size)
    main_app = interface.Application(main_host, host_name, port, routing_rules,
                                     run)
    main_app.run()
Exemplo n.º 4
0
def main():
    global connection, cursor

    connect()

    run_sql('drop.sql')
    run_sql('create_tables.sql')
    run_sql('insert.sql')

    # ==== Conexão interface ========
    root = Tk()
    interface.atribuir(cursor, connection)
    interface.Application(root)
    root.mainloop()
    # ===============================

    cursor.close()
Exemplo n.º 5
0
def run_all(databases=[{
    'host': 'localhost',
    'port': 6379,
    'password': None
}],
            host_name='127.0.0.1',
            port=5000,
            routing_rules=[],
            callback=None):
    ruleset_definitions = {}
    for rset in _rulesets:
        ruleset_name, ruleset_definition = rset.define()
        ruleset_definitions[ruleset_name] = ruleset_definition

    main_host = engine.Host(ruleset_definitions, databases)
    for start in _start_functions:
        start(main_host)

    main_app = interface.Application(main_host, host_name, port, routing_rules,
                                     callback)
    main_app.run()
Exemplo n.º 6
0
            actual_position = actual_node.found_position(cpt_pos)

        cpt += 1
        if (cpt % 1000) == 0:
            print("len to do: {} {} {}".format(len(to_do), len(actual_node.forms), cpt))

        if len(actual_node.forms) >= nb_good_pieces:
            res = actual_node
            break

        del actual_node

    print("We checked {} nodes".format(cpt))
    if res:
        print("One result is: ")
        for form in res.forms:
            print(form)

    else:
        print("no result, something went wrong!")

    app = interface.Application()  # Instantiate the application class
    app.master.title("Les cubes dans le cube")
    app.init_canvas(2 * GUI_LEVEL_DIST, 6 * GUI_SQUARE_SIZE)

    app.draw_forms(res.forms, GUI_LEVEL_DIST, GUI_SQUARE_SIZE)

    app.mainloop()  # Wait for events

    print("fin")
Exemplo n.º 7
0
 def test_frameLoading(self):
     app = interface.Application()
     self.assertEqual(len(app.frames), 3)