Beispiel #1
0
def getting_screenshot(device_path, path, WIDTH, HEIGHT, use_old=0):  # {{{
    if use_old == 0:
        print "getting screenshot ..."
        start_time = time.time()
        get_screenshot(device_path)
    else:
        print "using old screenshot ..."
        start_time = time.time()

    elapsed_time = time.time() - start_time
    print("getting time:{0}".format(elapsed_time)) + "[sec]"

    print "checking board ..."
    start_time = time.time()
    cmd = ["python", "padboard2.py", path, str(WIDTH), str(HEIGHT)]
    #print "cmd:" + str(cmd)
    p = subprocess.check_output(cmd)
    #print "p:" + str(p)
    sout = p.rstrip().split(",")
    if WIDTH == 5:
        board = pazdracombo.convert_h_w_5x4(sout[0])
    elif WIDTH == 6:
        board = pazdracombo.convert_h_w_6x5(sout[0])
    elif WIDTH == 7:
        board = pazdracombo.convert_h_w_7x6(sout[0])
    elapsed_time = time.time() - start_time
    print("checking time:{0}".format(elapsed_time)) + "[sec]"
    #print "board:" + str(board) + " , sout[1]:" + str(sout[1])
    return board, sout[1]  # }}}
Beispiel #2
0
def getting_screenshot(device_path, path, WIDTH, HEIGHT, use_old=0):  # {{{
    if use_old == 0:
        print "getting screenshot ..."
        start_time = time.time()
        get_screenshot(device_path)
    else:
        print "using old screenshot ..."
        start_time = time.time()

    elapsed_time = time.time() - start_time
    print ("getting time:{0}".format(elapsed_time)) + "[sec]"

    print "checking board ..."
    start_time = time.time()
    if WIDTH == 5:
        board = pazdracombo.convert_h_w_5x4(padboard.check_board(path, WIDTH, HEIGHT, 0))
    elif WIDTH == 6:
        board = pazdracombo.convert_h_w_6x5(padboard.check_board(path, WIDTH, HEIGHT, 0))
    elif WIDTH == 7:
        board = pazdracombo.convert_h_w_7x6(padboard.check_board(path, WIDTH, HEIGHT, 0))
        # print "7x6 board: " + str(board)
        # print " sorry, no implement 7x6 board"
        # return (WIDTH, HEIGHT)
    elapsed_time = time.time() - start_time
    print ("checking time:{0}".format(elapsed_time)) + "[sec]"
    return board  # }}}
Beispiel #3
0
def getting_screenshot(device_path, path, WIDTH, HEIGHT, use_old=0):# {{{
    if use_old == 0:
        print "getting screenshot ..."
        start_time = time.time()
        get_screenshot(device_path)
    else:
        print "using old screenshot ..."
        start_time = time.time()

    elapsed_time = time.time() - start_time
    print("getting time:{0}".format(elapsed_time)) + "[sec]"

    print "checking board ..."
    start_time = time.time()
    cmd = ["python", "padboard2.py", path, str(WIDTH), str(HEIGHT)]
    #print "cmd:" + str(cmd)
    p = subprocess.check_output(cmd)
    #print "p:" + str(p)
    sout = p.rstrip().split(",")
    if WIDTH == 5:
        board = pazdracombo.convert_h_w_5x4(sout[0])
    elif WIDTH == 6:
        board = pazdracombo.convert_h_w_6x5(sout[0])
    elif WIDTH == 7:
        board = pazdracombo.convert_h_w_7x6(sout[0])
    elapsed_time = time.time() - start_time
    print("checking time:{0}".format(elapsed_time)) + "[sec]"
    #print "board:" + str(board) + " , sout[1]:" + str(sout[1])
    return board, sout[1]# }}}
Beispiel #4
0
def getting_screenshot(device_path,
                       device_name,
                       filename,
                       path,
                       WIDTH,
                       HEIGHT,
                       use_old=0):  # {{{
    if use_old == 0:
        print "getting screenshot ..."
        start_time = time.time()
        get_screenshot(device_path, device_name, filename)
    else:
        print "using old screenshot ..."
        start_time = time.time()

    elapsed_time = time.time() - start_time
    print("getting time:{0}".format(elapsed_time)) + "[sec]"

    print "checking board ..."
    start_time = time.time()
    if WIDTH == 5:
        board = pazdracombo.convert_h_w_5x4(
            padboard.check_board(path, WIDTH, HEIGHT, 0))
    elif WIDTH == 6:
        board = pazdracombo.convert_h_w_6x5(
            padboard.check_board(path, WIDTH, HEIGHT, 0))
    elif WIDTH == 7:
        board = pazdracombo.convert_h_w_7x6(
            padboard.check_board(path, WIDTH, HEIGHT, 0))
    elapsed_time = time.time() - start_time
    print("checking time:{0}".format(elapsed_time)) + "[sec]"
    return board  # }}}