Skip to content

Commit

Permalink
first test qat
Browse files Browse the repository at this point in the history
  • Loading branch information
rmicheev committed Jan 12, 2024
1 parent 142bc72 commit 3af09bf
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pyperclip==1.8.2
pytesseract==0.3.10
pytest==7.2.2
python_Levenshtein==0.20.9
qat==0.4.2
52 changes: 52 additions & 0 deletions src/pygats/qat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import qat
from typing import Optional
from pygats.pygats import step, passed, failed


def register_application(name='', path='', args=''):
qat.register_application(name=name, path=path, args=args)


def start_application(ctx, name='', args=''):
step(ctx, f'Запуск приложения {name}')
app_ctx = qat.start_application(app_name=name, args=args)
qat.unlock_application()
passed()
return app_ctx


def close_application(ctx, app_context):
step(ctx, 'Закрытие приложения ...')
qat.close_application(app_context)
passed()


def typewrite(ctx, object: dict, message, count = 1):
step(ctx, f'Набрать на клавиатуре {message} ...')
for i in range(count):
qat.type_in(object, message)
passed()


def click_left_button(ctx, object: dict, x = None, y = None, clicks: Optional[int] = 1):
step(ctx, 'Нажать левую кнопку мыши ...')
qat.mouse_click(object, x, y)
passed()


def find_object(ctx, definition: dict):
step(ctx, 'Поиск объекта ...')
object = qat.wait_for_object_exists(definition)
passed()
return object


def find_all_objects(ctx, definition: dict):
step(ctx, 'Поиск всех объектов, соответствующих данному определению ...')
objects = qat.find_all_objects(definition)
passed()
return objects


# def list_top_windows():
# return qat.list_top_windows()

0 comments on commit 3af09bf

Please sign in to comment.