Exemple #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]  # }}}
Exemple #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()
    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]# }}}
Exemple #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()
    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  # }}}
Exemple #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  # }}}
Exemple #5
0
import time
import sys

argvs = sys.argv
argc = len(argvs)

#print argvs
for i in range(len(argvs)):
    print "argvs[" + str(i) + "]: " + str(argvs[i])
print argc
print

if (argc != 4):
    print "Usage: # python %s path width height" % argvs[0]
    quit()

start_time = time.time()

#path = ".\screen_sh-01f_5x4.png"
#WIDTH = 5
#HEIGHT = 4
#answer_5x4 = "dbdcbbddcrldrgllrcbc"

#board = pazdracombo.convert_h_w_5x4(padboard.check_board(path, WIDTH, HEIGHT, 0))
temp_board, width = padboard2.check_board(argvs[1], int(argvs[2]), int(argvs[3]), 0)
board = pazdracombo.convert_h_w_5x4(temp_board)
print "[5x4]"
print board
print width