示例#1
0
def login(*event):
    username = username_box.get()
    email_regex = re.compile(
        '(^|\s)[-a-z0-9_.]+@([-a-z0-9]+\.)+[a-z]{2,6}(\s|$)')
    is_valid = email_regex.match(username)
    if is_valid:
        print username
        db = MySQLdb.connect(host="eu-cdbr-sl-lhr-01.cleardb.net",
                             user="******",
                             passwd="1561ab78",
                             db="ibmx_29e62892a53c4f3")
        cursor = db.cursor()
        cursor.execute(
            "SELECT Passwords FROM ibmx_29e62892a53c4f3.persons WHERE Mail = %s;",
            (username))
        datafromdb = cursor.fetchall()
        cursor.close()
        db.close()
        passwords = password_box.get()
        h2 = hashlib.md5(passwords)
        print passwords
        print 'ok'
        if len(datafromdb) == 1 and datafromdb[0][0] == h2.hexdigest():
            print passwords
            main.destroy()
            program.start(username)

        else:
            error = Label(main, text='No data in base',
                          fg='red').grid(row=7, column=5, sticky='NESW')

    else:
        error = Label(main, text='Not correct data!!!',
                      fg='red').grid(row=7, column=5, sticky='NESW')
示例#2
0
def programcmd(name, run_description):
    if not paths.suite_defined(): return # cannot run without project env defined
    import program
    if name:
        if not run_description:
            print("Add a second argument to describe the program execution, e.g.: '40 web fronts, Redis backend'")
        else:
            program.start(name, run_description)
    else:
        program.show_programs()
示例#3
0
def programcmd(name, run_description):
    if not paths.suite_defined():
        return  # cannot run without project env defined
    import program
    if name:
        if not run_description:
            print(
                "Add a second argument to describe the program execution, e.g.: '40 web fronts, Redis backend'"
            )
        else:
            program.start(name, run_description)
    else:
        program.show_programs()
示例#4
0
def interface_training(username):
    # Стартуем потоки
    global username1
    username1 = username
    m = threading.Thread(target=lets_start)
    b = threading.Thread(target=receive_data)

    m.start()
    b.start()

    go()
    time.sleep(140)
    program.start(username1)
示例#5
0
def start(name, description):
    sequence = get(name)
    now = time.strftime('%Y-%m-%d-%H:%M:%S')
    print('==> [%s] Starting sequence %s' % (now, name))
    browser.open()

    programs = sequence['programs']
    for prog in programs:
        total = program.get_total(prog)
        sleep = total + sequence['wait']
        now = time.strftime('%Y-%m-%d-%H:%M:%S')
        print('==> [%s] Starting program %s (will last %i minutes)' % (now, prog, sleep))
        program.start(prog, description)
        systools.easysleep(sleep * 60)

    now = time.strftime('%Y-%m-%d-%H:%M:%S')
    print('==> [%s] Done' % (now))
示例#6
0
def start(name, description):
    sequence = get(name)
    now = time.strftime('%Y-%m-%d-%H:%M:%S')
    print('==> [%s] Starting sequence %s' % (now, name))
    browser.open()

    programs = sequence['programs']
    for prog in programs:
        total = program.get_total(prog)
        sleep = total + sequence['wait']
        now = time.strftime('%Y-%m-%d-%H:%M:%S')
        print('==> [%s] Starting program %s (will last %i minutes)' %
              (now, prog, sleep))
        program.start(prog, description)
        systools.easysleep(sleep * 60)

    now = time.strftime('%Y-%m-%d-%H:%M:%S')
    print('==> [%s] Done' % (now))
示例#7
0
def startProgram():
    try:
        res = program.start()
        return json.dumps({'result': res})
    except Exception as e:
        return __exceptionResponse(e)
示例#8
0
import program
'''
Rezda Abdullah Fachrezzi
13519194

Tucil 2 IF2211 - Algoritma Decrease and Conquer

program.py berisi algoritma
util.py berisi fungsi-fungsi bantuan

Parameter pada fungsi start, yaitu
start(nointro: boolean, showsorted: boolean)

Apabila nointro bernilai True, program tidak akan menuliskan intro, vice versa. (default: False)
Apabila showsorted bernilai True, program akan menuliskan graf yang sudah diurutkan. (default: False)
'''

program.start()
示例#9
0
def startProgram(event_name, template, csv):
    if event_name and template and csv:
        start(event_name, template, csv)
        return True
    else:
        return "incomplete"