示例#1
0
文件: cool.py 项目: foggsz/luck
def main_steps(position, key):
    step4 = "adb shell input tap {0} {1} ".format(position[0], position[1])
    pipe = Popen(step4, shell=True)
    pipe.wait()

    gzhDetail_x, gzhDetail_y = get_point("gzhDetail_btn")  #公众号详情按钮
    step5 = "adb shell input tap {0}  {1}".format(gzhDetail_x, gzhDetail_y)
    pipe = Popen(step5, shell=True)
    pipe.wait()
    # swipe1_x, swipe1_y = get_point("swipe1")   #公众号详情按钮滚动起点
    # step6 = """
    #     adb shell input swipe1  {0}  {1}  0  0
    # """.format(swipe1_x,  swipe1_y)
    # pipe = Popen(step6, shell=True)
    # pipe.wait()

    allMessage_x, allMessage_y = get_point("allMessage_btn")  #全部消息按钮
    step7 = "adb shell input tap  {0}  {1} ".format(allMessage_x, allMessage_y)
    pipe = Popen(step7, shell=True)
    pipe.wait()

    #打开页面休息5秒
    time.sleep(5)

    #返回列表页面操作
    step8 = """
        input keyevent 4
        input keyevent 4
        input keyevent 4
        exit
    """
    step8 = bytes(step8, encoding="utf-8")
    pipe = Popen(adb_start, stdin=PIPE, stdout=PIPE)
    pipe.communicate(input=step8)
def intersection_with_cone(point, vector, angle):
    print("Cone with a {} degree angle".format(angle))
    print("Line passing through the point ({}, {}, {})".format(
        point.x, point.y, point.z),
          end=" ")
    print("and parallel to the vector ({}, {}, {})".format(
        vector.x, vector.y, vector.z))
    tan_angle = tan(radians(angle))
    a = pow(vector.x, 2) + pow(vector.y,
                               2) - (pow(vector.z, 2) * pow(tan_angle, 2))
    b = 2 * ((point.x * vector.x) + (point.y * vector.y) -
             ((point.z * vector.z) * pow(tan_angle, 2)))
    c = pow(point.x, 2) + pow(point.y,
                              2) - (pow(point.z, 2) * pow(tan_angle, 2))
    if round(a, 5) == 0.0:
        if round(b, 5) == 0 or round(c, 5):
            return None
        t = -c / b
        return [get_point(point, vector, t)]
    delta = pow(b, 2) - (4 * a * c)
    if delta == 0:
        t = -b / (2 * a)
        return [get_point(point, vector, t)]
    elif delta > 0:
        t1 = (-b + sqrt(delta)) / (2 * a)
        t2 = (-b - sqrt(delta)) / (2 * a)
        return [get_point(point, vector, t1), get_point(point, vector, t2)]
    return None
示例#3
0
def determine_solution(point, vector, radius):
    a = pow(vector.x, 2) + pow(vector.y, 2)
    b = 2 * point.x * vector.x + 2 * point.y * vector.y
    c = pow(point.x, 2) + pow(point.y, 2) - pow(radius, 2)
    solution = list()

    if a == 0:
        if b == 0:
            return None
        t = -c / b
        solution.append(get_point(point, vector, t))
    else:
        delta = pow(b, 2) - 4 * a * c

        if (delta > 0):
            x1 = (-b + sqrt(delta)) / (2 * a)
            x2 = (-b - sqrt(delta)) / (2 * a)
            solution.append(get_point(point, vector, x1))
            solution.append(get_point(point, vector, x2))
        elif (delta == 0):
            x = -b / (2 * a)
            solution.append(get_point(point, vector, x))
        else:
            return None
    return solution
def intersection_with_sphere(point, vector, radius):
    print("Sphere of radius {}".format(radius))
    print("Line passing through the point ({}, {}, {})".format(
        point.x, point.y, point.z),
          end=" ")
    print("and parallel to the vector ({}, {}, {})".format(
        vector.x, vector.y, vector.z))
    a = pow(vector.x, 2) + pow(vector.y, 2) + pow(vector.z, 2)
    b = 2 * ((point.x * vector.x) + (point.y * vector.y) +
             (point.z * vector.z))
    c = pow(point.x, 2) + pow(point.y, 2) + pow(point.z, 2) - pow(radius, 2)
    if a == 0:
        if b == 0:
            return None
        t = -c / b
        return [get_point(point, vector, t)]
    delta = pow(b, 2) - (4 * a * c)
    if delta == 0:
        t = -b / (2 * a)
        return [get_point(point, vector, t)]
    elif delta > 0:
        t1 = (-b + sqrt(delta)) / (2 * a)
        t2 = (-b - sqrt(delta)) / (2 * a)
        return [get_point(point, vector, t1), get_point(point, vector, t2)]
    return None
示例#5
0
文件: chrome.py 项目: foggsz/luck
def start():  #启动微信
    step0 = "adb {0} shell am start -n  com.tencent.mm/.ui.LauncherUI ".format(
        device)
    pipe = Popen(step0, shell=True)
    pipe.wait()
    time.sleep(10)
    help_x, help_y = get_point("help", toDevice=device)
    step1 = "adb {0} shell input tap  {1} {2}".format(device, help_x, help_y)
    pipe = Popen(step1, shell=True)
    pipe.wait()
示例#6
0
文件: chrome.py 项目: foggsz/luck
def step(url):  #每一步
    adb_start = "adb {0} shell  ".format(device)
    adb_start = shlex.split(adb_start)
    url = str(url)
    url = '\'' + url + '\''
    edit_x, edit_y = get_point("edit", toDevice=device)
    pipe = Popen(adb_start, stdin=PIPE, stdout=PIPE)
    step0 = """
        input tap {0} {1}
        input text {2}
        input keyevent 111
        exit
    """.format(edit_x, edit_y, url)
    step0 = bytes(step0, encoding="utf-8")
    pipe.communicate(input=step0)
    send_x, send_y = get_point("send", toDevice=device)
    setp1 = "adb {0} shell input tap {1} {2}".format(device, send_x, send_y)
    pipe = Popen(setp1, shell=True)
    pipe.wait()

    nowUrl_x, nowUrl_y = get_point("nowUrl", toDevice=device)
    setp2 = "adb {0} shell input tap {1} {2} ".format(device, nowUrl_x,
                                                      nowUrl_y)
    pipe = Popen(setp2, shell=True)
    pipe.wait()
    time.sleep(8)

    temp_alert = get_point("alert", toDevice=device)  #安全警告还是  被限制
    if temp_alert:
        if temp_alert == "limit":
            raise ValueError("limit")
        else:
            alert_x, alert_y = temp_alert
            setp3 = "adb {0} shell input tap {1} {2} ".format(
                device, alert_x, alert_y)
            pipe = Popen(setp3, shell=True)
            pipe.wait()
            time.sleep(5)
    setp4 = "adb {0} shell input keyevent 4".format(device)
    pipe = Popen(setp4, shell=True)
    pipe.wait()
示例#7
0
文件: cool.py 项目: foggsz/luck
def start():
    adb_start = ['adb', 'shell']
    """
    按钮名字
    search_btn     
    telList_btn
    gzhDetail_btn
    """
    step0 = b"""
    am start -n  com.tencent.mm/.ui.LauncherUI 
    exit
    """
    pipe = Popen(adb_start, stdin=PIPE, stdout=PIPE)
    outs, errs = pipe.communicate(input=step0, timeout=15)
    telList_x, telList_y = get_point("telList_btn")  #通讯录坐标
    step1 = "adb shell input tap  {0}  {1}".format(telList_x, telList_y)
    pipe = Popen(step1, shell=True)
    pipe.wait()

    gzh_x, gzh_y = get_point("gzh_btn")  #公众号按钮
    step2 = "adb shell input tap  {0}  {1}".format(gzh_x, gzh_y)
    pipe = Popen(step2, shell=True)
    pipe.wait()
示例#8
0
文件: cool.py 项目: foggsz/luck
def get_points(findName=None):
    total, gzh_total = get_point("swipe0", findName)  #滑动开始,获得公众号底部总数
    print(points)
示例#9
0
文件: cool.py 项目: foggsz/luck
def main_run():
    for item in points["map"]:
        swipe = None
        for key, val in item.items():
            # if store.get("start_name"):  #如果有起始位置
            # else:
            if key == "swipe":
                swipe = val
            else:
                main_steps(val, key)

        if swipe:
            step_swider = "adb shell input swipe {0[0]}  {0[1]}   {0[2]}  {0[3]}  2000".format(
                swipe)
            pipe = Popen(step_swider, shell=True)
            pipe.wait()


if __name__ == "__main__":
    start()
    get_points()
    #退出重新进,再次进入公众号
    step3 = "adb shell input keyevent 4"
    pipe = Popen(step3, shell=True)
    pipe.wait()

    gzh_x, gzh_y = get_point("gzh_btn")  #公众号按钮
    step2 = "adb shell input tap  {0}  {1}".format(gzh_x, gzh_y)
    pipe = Popen(step2, shell=True)
    pipe.wait()
    main_run()