Пример #1
0
def record_path(data, num_path=0):
    coords_path = []
    time_start = time.perf_counter()
    time.sleep(0.1)
    while (RECORD):
        xmouse, ymouse = pyautogui.position()
        position = (xmouse, ymouse, (time.perf_counter() - time_start) * 1000)
        coords_path.append(position)
        cp.cprint2(
            '2\rЗапись №{num: >2} ^14_x{x: >4} ^15_y{y: >4}  ^8_time{time: <18}  '
            .format(x=position[0],
                    y=position[1],
                    time=position[2],
                    num=num_path))
        # time.sleep(0.01)  # сколько ни ставь, минимум 15~16 ms
    else:
        coords_path = filter_double_coords(coords_path)
        cp.cprint(
            '2\rЗапись №{num: >2} ^14_x{x: >4} ^15_y{y: >4}  ^8_time{time: <18}  ^4_Stop  ^0_► len {length} points'
            .format(x=position[0],
                    y=position[1],
                    time=position[2],
                    num=num_path,
                    length=len(coords_path)))
        data.append(coords_path)
        filename = savefile(coords_path)
        num_path += 1
    return num_path, filename
Пример #2
0
def hotkey_exit():
    global EXIT_SCRIPT
    EXIT_SCRIPT = True
    global RECORD
    RECORD = False
    # keyboard.unhook_all_hotkeys()
    cp.cprint('0\n\nЗаписываем файл...')
Пример #3
0
def filedata_read(filename):
    try:
        with open(filename, 'r', encoding='utf-8') as fr:
            str_arrey = fr.read().split('\n')
    except Exception as e:
       cp.cprint(f'4Ошибка чтения файла ^15_{filename}')
       # print(e.__class__)
       exit(1)
    points = []
    try:
        for s in str_arrey:
            dat = s.split(' ')
            points.append([
                        int(dat[0]),
                        int(dat[1]),
                        float(dat[2])
                        ])
    except Exception as e:
        cp.cprint(f'4Неправильные данные в файле ^15_{filename}')
        exit(1)
    return points
Пример #4
0
def main():
    cp.cprint('1Управление:')
    cp.cprint('2_1 - ^1_Запустить запись координат')
    cp.cprint('4_2 - ^1_Остановить запись координат')
    cp.cprint('9_0 - ^1_Отрисовывать график Да/Нет.')
    cp.cprint('14Ctrl+Q - ^1_Выход')
    print('♦' * 100, '')
    write_status_drawgraph()

    add_hotkeys()

    num_path = 0
    data = []
    while (True):
        if EXIT_SCRIPT:
            exit_action(data)
        if RECORD:
            num_path, filename = record_path(data, num_path=num_path)
            if DRAWGRAPH:
                Graphic_report.mouse_graph_report(filename, imagesave=True)
        time.sleep(0.1)
Пример #5
0
    os.chdir(PATH_SCRIPT)
    cc.clearConsol()

    __author__ = 'master by Vint'
    __title__ = '--- Graphic_report ---'
    __version__ = '0.2.1'
    __copyright__ = 'Copyright 2020 (c)  bitbucket.org/Vintets'
    auth_sh.authorship(__author__, __title__, __version__, __copyright__, width=_width)

    filename = 'path_2020.11.16_14-29-20_points113.txt'
    # filename = 'path_2020.11.16_13-49-40_points89.txt'

    if len(sys.argv) > 1:
        filename = sys.argv[1]
        if not os.path.isfile(filename):
            cp.cprint('2Передан параметр не соответствующий пути существующего файла')
            exit(1)
    elif not filename:
        cp.cprint('2Не задан файл с данными для построения')
        exit(1)

    try:
        mouse_graph_report(filename, imagesave=IMAGESAVE)
    except KeyboardInterrupt:
        print('Программа прервана пользователем')

    if not CLOSECONSOLE:
        input('\n---------------   END   ---------------')
    else:
        exit()
Пример #6
0
def write_status_drawgraph():
    status = 'Да' if DRAWGRAPH else 'Нет'
    cp.cprint(f'3_Отрисовывать график: ^15_{status}')
Пример #7
0
    __author__ = 'master by Vint'
    __title__ = '--- Mouse_record ---'
    __version__ = '0.2.0'
    __copyright__ = 'Copyright 2020 (c)  bitbucket.org/Vintets'
    auth_sh.authorship(__author__,
                       __title__,
                       __version__,
                       __copyright__,
                       width=_width)

    if len(sys.argv) > 1:
        filename = sys.argv[1]
        if not os.path.isfile(filename):
            cp.cprint(
                '2Передан параметр не соответствующий пути существующего файла'
            )
            exit(1)
        Graphic_report.mouse_graph_report(filename, imagesave=True)

    try:
        main()
    except KeyboardInterrupt:
        print('Программа прервана пользователем')

    if not CLOSECONSOLE:
        input('\n---------------   END   ---------------')
    else:
        time.sleep(1)
        exit()